From 14f9741b82c50389b5061b50ff22de50fe4e50af Mon Sep 17 00:00:00 2001 From: Gerard Bosch Date: Wed, 16 Feb 2022 10:21:36 +0100 Subject: [PATCH] Add docopt.sh option: DOCOPT_OPTIONS_FIRST=true This will allow to use `resticw` as a true wrapper, enabling to pass restic options through it, for example: ``` resticw --profile profileX snapshots --compact ``` will now be suported by the wraper :) --- bin/resticw | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bin/resticw b/bin/resticw index c0fa747..4514c1d 100644 --- a/bin/resticw +++ b/bin/resticw @@ -116,8 +116,9 @@ else eval "${prefix}"'_restic_arguments_line_=()'; fi; local docopt_i=1 declare -p "${prefix}__profile" "${prefix}_restic_arguments_line_"; done; } # docopt parser above, complete command for generating this parser is `docopt.sh resticw` -# Parse arguments -eval "$(docopt "$@")" # See https://github.com/andsens/docopt.sh for the magic :) +# Parse arguments - See https://github.com/andsens/docopt.sh for the magic :) +DOCOPT_OPTIONS_FIRST=true # treat everything after the first non-option as commands/arguments +eval "$(docopt "$@")" # --^^^-- END OF GENERATED COMMAND LINE PARSING STUFF --^^^-- #