From 13e58869dc0bf24acacc98650ef95d0d27598a4f Mon Sep 17 00:00:00 2001 From: merakor Date: Mon, 9 Nov 2020 13:03:20 +0000 Subject: getoptions(): parse the options during main() call on cpt-lib Calling parse() after cpt-lib has been called causes sys_db to be initiated using the wrong CPT_ROOT, among other issues. By calling the option parser during the main(), we make sure that the options parsed are used as soon as possible. FossilOrigin-Name: 2933b99bec8ec9c3f20143e2a19c270a6d208f723d2b394c625cbc13d2625326 --- src/cpt-lib | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/cpt-lib') diff --git a/src/cpt-lib b/src/cpt-lib index a9522e8..e5d526a 100644 --- a/src/cpt-lib +++ b/src/cpt-lib @@ -1777,6 +1777,14 @@ create_cache() { main() { set -ef + # If a parser definition exists, let's run it ourselves. This makes sure we + # get the variables as soon as possible. + command -v parser_definition >/dev/null && { + eval "$(getoptions parser_definition parse "$0")" + parse "$@" + eval set -- "$REST" + } + # Create the cache directories for CPT and set the variables which point # to them. This is seperate from temporary directories created in # create_cache(). That's because we need these variables set on most -- cgit v1.2.3