bugfix: load variables and functions only once
This commit is contained in:
22
src/main.sh
22
src/main.sh
@@ -2,17 +2,24 @@
|
|||||||
|
|
||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
|
if [ ! "${SCRIPT_LOADED:-}" ]; then
|
||||||
# Helper functions
|
# Helper functions
|
||||||
. "sh/helper.sh"
|
. "sh/helper.sh"
|
||||||
|
|
||||||
# Read theme
|
# Read theme
|
||||||
. "sh/theme.sh"
|
. "sh/theme.sh"
|
||||||
|
|
||||||
# Read configuration
|
# Read configuration
|
||||||
. "sh/config.sh"
|
. "sh/config.sh"
|
||||||
|
|
||||||
# Load awk scripts
|
# Load awk scripts
|
||||||
. "sh/awkscripts.sh"
|
. "sh/awkscripts.sh"
|
||||||
|
# iCalendar routines
|
||||||
|
. "sh/icalendar.sh"
|
||||||
|
# Attachment handling
|
||||||
|
. "sh/attachment.sh"
|
||||||
|
# Categories handling
|
||||||
|
. "sh/categories.sh"
|
||||||
|
# Mark as loaded
|
||||||
|
export SCRIPT_LOADED=1
|
||||||
|
fi
|
||||||
|
|
||||||
__lines() {
|
__lines() {
|
||||||
find "$ROOT" -type f -name '*.ics' -print0 | xargs -0 -P 0 \
|
find "$ROOT" -type f -name '*.ics' -print0 | xargs -0 -P 0 \
|
||||||
@@ -90,9 +97,6 @@ Examples:
|
|||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# iCalendar routines
|
|
||||||
. "sh/icalendar.sh"
|
|
||||||
|
|
||||||
# Command line arguments: Interal use
|
# Command line arguments: Interal use
|
||||||
. "sh/cliinternal.sh"
|
. "sh/cliinternal.sh"
|
||||||
|
|
||||||
@@ -102,12 +106,6 @@ fi
|
|||||||
# Parse command-line filter (if any)
|
# Parse command-line filter (if any)
|
||||||
. "sh/filter.sh"
|
. "sh/filter.sh"
|
||||||
|
|
||||||
# Attachment handling
|
|
||||||
. "sh/attachment.sh"
|
|
||||||
|
|
||||||
# Categories handling
|
|
||||||
. "sh/categories.sh"
|
|
||||||
|
|
||||||
if [ -n "${list_option:-}" ]; then
|
if [ -n "${list_option:-}" ]; then
|
||||||
__lines |
|
__lines |
|
||||||
$FZF \
|
$FZF \
|
||||||
|
|||||||
Reference in New Issue
Block a user