bashly 0.8.2 → 0.8.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bashly/concerns/renderable.rb +3 -6
- data/lib/bashly/extensions/string.rb +2 -2
- data/lib/bashly/templates/strings.yml +1 -0
- data/lib/bashly/version.rb +1 -1
- data/lib/bashly/views/README.md +6 -0
- data/lib/bashly/views/argument/usage.gtx +15 -0
- data/lib/bashly/views/argument/validations.gtx +11 -0
- data/lib/bashly/views/command/catch_all_filter.gtx +10 -0
- data/lib/bashly/views/command/command_fallback.gtx +42 -0
- data/lib/bashly/views/command/command_filter.gtx +29 -0
- data/lib/bashly/views/command/command_functions.gtx +5 -0
- data/lib/bashly/views/command/default_assignments.gtx +13 -0
- data/lib/bashly/views/command/default_initialize_script.gtx +7 -0
- data/lib/bashly/views/command/default_root_script.gtx +4 -0
- data/lib/bashly/views/command/default_script.gtx +5 -0
- data/lib/bashly/views/command/dependencies_filter.gtx +10 -0
- data/lib/bashly/views/command/environment_variables_filter.gtx +18 -0
- data/lib/bashly/views/command/fixed_flags_filter.gtx +20 -0
- data/lib/bashly/views/command/footer.gtx +5 -0
- data/lib/bashly/views/command/function.gtx +6 -0
- data/lib/bashly/views/command/initialize.gtx +12 -0
- data/lib/bashly/views/command/inspect_args.gtx +21 -0
- data/lib/bashly/views/command/long_usage.gtx +13 -0
- data/lib/bashly/views/command/master_script.gtx +17 -0
- data/lib/bashly/views/command/normalize_input.gtx +25 -0
- data/lib/bashly/views/command/parse_requirements.gtx +26 -0
- data/lib/bashly/views/command/parse_requirements_case.gtx +11 -0
- data/lib/bashly/views/command/parse_requirements_case_catch_all.gtx +23 -0
- data/lib/bashly/views/command/parse_requirements_case_repeatable.gtx +24 -0
- data/lib/bashly/views/command/parse_requirements_case_simple.gtx +25 -0
- data/lib/bashly/views/command/parse_requirements_while.gtx +33 -0
- data/lib/bashly/views/command/required_args_filter.gtx +13 -0
- data/lib/bashly/views/command/required_flags_filter.gtx +12 -0
- data/lib/bashly/views/command/root_command.gtx +6 -0
- data/lib/bashly/views/command/run.gtx +28 -0
- data/lib/bashly/views/command/usage.gtx +50 -0
- data/lib/bashly/views/command/usage_args.gtx +20 -0
- data/lib/bashly/views/command/usage_commands.gtx +18 -0
- data/lib/bashly/views/command/usage_environment_variables.gtx +10 -0
- data/lib/bashly/views/command/usage_examples.gtx +10 -0
- data/lib/bashly/views/command/usage_fixed_flags.gtx +13 -0
- data/lib/bashly/views/command/usage_flags.gtx +7 -0
- data/lib/bashly/views/command/user_filter.gtx +13 -0
- data/lib/bashly/views/command/user_lib.gtx +11 -0
- data/lib/bashly/views/command/version_command.gtx +6 -0
- data/lib/bashly/views/command/whitelist_filter.gtx +41 -0
- data/lib/bashly/views/environment_variable/usage.gtx +11 -0
- data/lib/bashly/views/flag/case.gtx +6 -0
- data/lib/bashly/views/flag/case_arg.gtx +25 -0
- data/lib/bashly/views/flag/case_no_arg.gtx +11 -0
- data/lib/bashly/views/flag/conflicts.gtx +22 -0
- data/lib/bashly/views/flag/usage.gtx +15 -0
- data/lib/bashly/views/flag/validations.gtx +11 -0
- data/lib/bashly/views/wrapper/bash3_bouncer.gtx +7 -0
- data/lib/bashly/views/wrapper/header.gtx +5 -0
- data/lib/bashly/views/wrapper/wrapper.gtx +8 -0
- metadata +76 -60
- data/lib/bashly/views/argument/usage.erb +0 -10
- data/lib/bashly/views/argument/validations.erb +0 -8
- data/lib/bashly/views/command/catch_all_filter.erb +0 -7
- data/lib/bashly/views/command/command_fallback.erb +0 -45
- data/lib/bashly/views/command/command_filter.erb +0 -22
- data/lib/bashly/views/command/command_functions.erb +0 -4
- data/lib/bashly/views/command/default_assignments.erb +0 -7
- data/lib/bashly/views/command/default_initialize_script.erb +0 -6
- data/lib/bashly/views/command/default_root_script.erb +0 -3
- data/lib/bashly/views/command/default_script.erb +0 -4
- data/lib/bashly/views/command/dependencies_filter.erb +0 -9
- data/lib/bashly/views/command/environment_variables_filter.erb +0 -14
- data/lib/bashly/views/command/fixed_flags_filter.erb +0 -24
- data/lib/bashly/views/command/footer.erb +0 -3
- data/lib/bashly/views/command/function.erb +0 -4
- data/lib/bashly/views/command/initialize.erb +0 -8
- data/lib/bashly/views/command/inspect_args.erb +0 -19
- data/lib/bashly/views/command/master_script.erb +0 -14
- data/lib/bashly/views/command/normalize_input.erb +0 -24
- data/lib/bashly/views/command/parse_requirements.erb +0 -22
- data/lib/bashly/views/command/parse_requirements_case.erb +0 -8
- data/lib/bashly/views/command/parse_requirements_case_catch_all.erb +0 -18
- data/lib/bashly/views/command/parse_requirements_case_repeatable.erb +0 -18
- data/lib/bashly/views/command/parse_requirements_case_simple.erb +0 -18
- data/lib/bashly/views/command/parse_requirements_while.erb +0 -26
- data/lib/bashly/views/command/required_args_filter.erb +0 -7
- data/lib/bashly/views/command/required_flags_filter.erb +0 -7
- data/lib/bashly/views/command/root_command.erb +0 -4
- data/lib/bashly/views/command/run.erb +0 -23
- data/lib/bashly/views/command/usage.erb +0 -50
- data/lib/bashly/views/command/usage_args.erb +0 -14
- data/lib/bashly/views/command/usage_commands.erb +0 -13
- data/lib/bashly/views/command/usage_environment_variables.erb +0 -6
- data/lib/bashly/views/command/usage_examples.erb +0 -7
- data/lib/bashly/views/command/usage_fixed_flags.erb +0 -17
- data/lib/bashly/views/command/usage_flags.erb +0 -4
- data/lib/bashly/views/command/user_filter.erb +0 -11
- data/lib/bashly/views/command/user_lib.erb +0 -6
- data/lib/bashly/views/command/version_command.erb +0 -4
- data/lib/bashly/views/command/whitelist_filter.erb +0 -33
- data/lib/bashly/views/environment_variable/usage.erb +0 -7
- data/lib/bashly/views/flag/case.erb +0 -4
- data/lib/bashly/views/flag/case_arg.erb +0 -19
- data/lib/bashly/views/flag/case_no_arg.erb +0 -8
- data/lib/bashly/views/flag/conflicts.erb +0 -18
- data/lib/bashly/views/flag/usage.erb +0 -10
- data/lib/bashly/views/flag/validations.erb +0 -8
- data/lib/bashly/views/wrapper/bash3_bouncer.erb +0 -5
- data/lib/bashly/views/wrapper/header.erb +0 -4
- data/lib/bashly/views/wrapper/wrapper.erb +0 -6
@@ -1,24 +0,0 @@
|
|
1
|
-
<%= view_marker %>
|
2
|
-
case "${1:-}" in
|
3
|
-
% if root_command?
|
4
|
-
% if short_flag_exist? "-v"
|
5
|
-
--version )
|
6
|
-
% else
|
7
|
-
--version | -v )
|
8
|
-
% end
|
9
|
-
version_command
|
10
|
-
exit
|
11
|
-
;;
|
12
|
-
|
13
|
-
% end
|
14
|
-
% if short_flag_exist? "-h"
|
15
|
-
--help )
|
16
|
-
% else
|
17
|
-
--help | -h )
|
18
|
-
% end
|
19
|
-
long_usage=yes
|
20
|
-
<%= function_name %>_usage
|
21
|
-
exit
|
22
|
-
;;
|
23
|
-
|
24
|
-
esac
|
@@ -1,19 +0,0 @@
|
|
1
|
-
<%= view_marker %>
|
2
|
-
inspect_args() {
|
3
|
-
readarray -t sorted_keys < <(printf '%s\n' "${!args[@]}" | sort)
|
4
|
-
if (( ${#args[@]} )); then
|
5
|
-
echo args:
|
6
|
-
for k in "${sorted_keys[@]}"; do echo "- \${args[$k]} = ${args[$k]}"; done
|
7
|
-
else
|
8
|
-
echo args: none
|
9
|
-
fi
|
10
|
-
|
11
|
-
if (( ${#other_args[@]} )); then
|
12
|
-
echo
|
13
|
-
echo other_args:
|
14
|
-
echo "- \${other_args[*]} = ${other_args[*]}"
|
15
|
-
for i in "${!other_args[@]}"; do
|
16
|
-
echo "- \${other_args[$i]} = ${other_args[$i]}"
|
17
|
-
done
|
18
|
-
fi
|
19
|
-
}
|
@@ -1,14 +0,0 @@
|
|
1
|
-
<%= view_marker %>
|
2
|
-
<%= render :root_command if commands.empty? %>
|
3
|
-
<%= render :version_command %>
|
4
|
-
<%= render :usage %>
|
5
|
-
<%= render :normalize_input %>
|
6
|
-
<%= render :inspect_args %>
|
7
|
-
<%= render :user_lib if user_lib.any? %>
|
8
|
-
<%= render :command_functions %>
|
9
|
-
<%= render :parse_requirements %>
|
10
|
-
<%= render :initialize %>
|
11
|
-
<%= render :run %>
|
12
|
-
|
13
|
-
initialize
|
14
|
-
run "$@"
|
@@ -1,24 +0,0 @@
|
|
1
|
-
<%= view_marker %>
|
2
|
-
normalize_input() {
|
3
|
-
local arg flags
|
4
|
-
|
5
|
-
while [[ $# -gt 0 ]]; do
|
6
|
-
arg="$1"
|
7
|
-
if [[ $arg =~ ^(--[a-zA-Z0-9_\-]+)=(.+)$ ]]; then
|
8
|
-
input+=("${BASH_REMATCH[1]}")
|
9
|
-
input+=("${BASH_REMATCH[2]}")
|
10
|
-
elif [[ $arg =~ ^(-[a-zA-Z0-9])=(.+)$ ]]; then
|
11
|
-
input+=("${BASH_REMATCH[1]}")
|
12
|
-
input+=("${BASH_REMATCH[2]}")
|
13
|
-
elif [[ $arg =~ ^-([a-zA-Z0-9][a-zA-Z0-9]+)$ ]]; then
|
14
|
-
flags="${BASH_REMATCH[1]}"
|
15
|
-
for (( i=0 ; i < ${#flags} ; i++ )); do
|
16
|
-
input+=("-${flags:i:1}")
|
17
|
-
done
|
18
|
-
else
|
19
|
-
input+=("$arg")
|
20
|
-
fi
|
21
|
-
|
22
|
-
shift
|
23
|
-
done
|
24
|
-
}
|
@@ -1,22 +0,0 @@
|
|
1
|
-
<%= view_marker %>
|
2
|
-
% if root_command?
|
3
|
-
parse_requirements() {
|
4
|
-
% else
|
5
|
-
<%= function_name %>_parse_requirements() {
|
6
|
-
% end
|
7
|
-
<%= render(:fixed_flags_filter).indent 2 %>
|
8
|
-
<%= render(:environment_variables_filter).indent 2 %>
|
9
|
-
<%= render(:dependencies_filter).indent 2 %>
|
10
|
-
<%= render(:command_filter).indent 2 %>
|
11
|
-
<%= render(:parse_requirements_while).indent 2 %>
|
12
|
-
<%= render(:required_args_filter).indent 2 %>
|
13
|
-
<%= render(:required_flags_filter).indent 2 %>
|
14
|
-
<%= render(:catch_all_filter).indent 2 %>
|
15
|
-
<%= render(:default_assignments).indent 2 %>
|
16
|
-
<%= render(:whitelist_filter).indent 2 %>
|
17
|
-
<%= render(:user_filter).indent 2 %>
|
18
|
-
}
|
19
|
-
|
20
|
-
% commands.each do |command|
|
21
|
-
<%= command.render :parse_requirements %>
|
22
|
-
% end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
<%= view_marker %>
|
2
|
-
% if args.any?
|
3
|
-
% condition = "if"
|
4
|
-
% args.each do |arg|
|
5
|
-
<%= condition %> [[ -z ${args[<%= arg.name %>]+x} ]]; then
|
6
|
-
<%= arg.render(:validations).indent 2 %>
|
7
|
-
args[<%= arg.name %>]=$1
|
8
|
-
shift
|
9
|
-
% condition = "elif"
|
10
|
-
% end
|
11
|
-
else
|
12
|
-
other_args+=("$1")
|
13
|
-
shift
|
14
|
-
fi
|
15
|
-
% else
|
16
|
-
other_args+=("$1")
|
17
|
-
shift
|
18
|
-
% end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
<%= view_marker %>
|
2
|
-
% condition = "if"
|
3
|
-
% args.each do |arg|
|
4
|
-
<%= condition %> [[ -z ${args[<%= arg.name %>]+x} ]]; then
|
5
|
-
<%= arg.render(:validations).indent 2 %>
|
6
|
-
% if arg.repeatable
|
7
|
-
args[<%= arg.name %>]="\"$1\""
|
8
|
-
shift
|
9
|
-
else
|
10
|
-
args[<%= arg.name %>]="${args[<%= arg.name %>]} \"$1\""
|
11
|
-
shift
|
12
|
-
% else
|
13
|
-
args[<%= arg.name %>]=$1
|
14
|
-
shift
|
15
|
-
% end
|
16
|
-
% condition = "elif"
|
17
|
-
% end
|
18
|
-
fi
|
@@ -1,18 +0,0 @@
|
|
1
|
-
<%= view_marker %>
|
2
|
-
% if args.any?
|
3
|
-
% condition = "if"
|
4
|
-
% args.each do |arg|
|
5
|
-
<%= condition %> [[ -z ${args[<%= arg.name %>]+x} ]]; then
|
6
|
-
<%= arg.render(:validations).indent 2 %>
|
7
|
-
args[<%= arg.name %>]=$1
|
8
|
-
shift
|
9
|
-
% condition = "elif"
|
10
|
-
% end
|
11
|
-
else
|
12
|
-
printf "<%= strings[:invalid_argument] %>\n" "$key"
|
13
|
-
exit 1
|
14
|
-
fi
|
15
|
-
% else
|
16
|
-
printf "<%= strings[:invalid_argument] %>\n" "$key"
|
17
|
-
exit 1
|
18
|
-
% end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
<%= view_marker %>
|
2
|
-
while [[ $# -gt 0 ]]; do
|
3
|
-
key="$1"
|
4
|
-
case "$key" in
|
5
|
-
% flags.each do |flag|
|
6
|
-
<%= flag.render(:case).indent 2 %>
|
7
|
-
|
8
|
-
% end
|
9
|
-
|
10
|
-
-?* )
|
11
|
-
% if catch_all.enabled?
|
12
|
-
other_args+=("$1")
|
13
|
-
shift
|
14
|
-
;;
|
15
|
-
% else
|
16
|
-
printf "<%= strings[:invalid_flag] %>\n" "$key"
|
17
|
-
exit 1
|
18
|
-
;;
|
19
|
-
% end
|
20
|
-
|
21
|
-
* )
|
22
|
-
<%= render(:parse_requirements_case).indent 4 %>
|
23
|
-
;;
|
24
|
-
|
25
|
-
esac
|
26
|
-
done
|
@@ -1,23 +0,0 @@
|
|
1
|
-
<%= view_marker %>
|
2
|
-
run() {
|
3
|
-
declare -A args=()
|
4
|
-
declare -a other_args=()
|
5
|
-
declare -a input=()
|
6
|
-
normalize_input "$@"
|
7
|
-
parse_requirements "${input[@]}"
|
8
|
-
|
9
|
-
<%- condition = "if" -%>
|
10
|
-
<%- deep_commands.each do |command| -%>
|
11
|
-
<%= condition %> [[ $action == "<%= command.action_name %>" ]]; then
|
12
|
-
if [[ ${args[--help]:-} ]]; then
|
13
|
-
long_usage=yes
|
14
|
-
<%= command.function_name %>_usage
|
15
|
-
else
|
16
|
-
<%= command.function_name %>_command
|
17
|
-
fi
|
18
|
-
<% condition = "elif" %>
|
19
|
-
<%- end -%>
|
20
|
-
<%= condition %> [[ $action == "root" ]]; then
|
21
|
-
root_command
|
22
|
-
fi
|
23
|
-
}
|
@@ -1,50 +0,0 @@
|
|
1
|
-
<%= view_marker %>
|
2
|
-
<%= function_name %>_usage() {
|
3
|
-
if [[ -n $long_usage ]]; then
|
4
|
-
<%- if summary == help -%>
|
5
|
-
printf "<%= caption_string %>\n"
|
6
|
-
echo
|
7
|
-
<%- else -%>
|
8
|
-
printf "<%= full_name %>\n"
|
9
|
-
echo
|
10
|
-
printf "<%= help.wrap(78).indent(2).sanitize_for_print %>\n"
|
11
|
-
echo
|
12
|
-
<%- end -%>
|
13
|
-
else
|
14
|
-
printf "<%= caption_string %>\n"
|
15
|
-
echo
|
16
|
-
fi
|
17
|
-
|
18
|
-
<%- if alt&.any? -%>
|
19
|
-
printf "<%= strings[:command_alias] % { alias: alt.join(', ') } %>\n"
|
20
|
-
echo
|
21
|
-
<%- end -%>
|
22
|
-
|
23
|
-
printf "<%= strings[:usage] %>\n"
|
24
|
-
printf " <%= usage_string %>\n"
|
25
|
-
<%- if commands.any? -%>
|
26
|
-
printf " <%= full_name %> [command] --help<%= " | -h" unless short_flag_exist? "-h" -%>\n"
|
27
|
-
<%- else -%>
|
28
|
-
printf " <%= full_name %> --help<%= " | -h" unless short_flag_exist? "-h" -%>\n"
|
29
|
-
<%- end -%>
|
30
|
-
<%- if root_command? -%>
|
31
|
-
printf " <%= full_name %> --version<%= " | -v" unless short_flag_exist? "-v" -%>\n"
|
32
|
-
<%- end -%>
|
33
|
-
echo
|
34
|
-
<%= render(:usage_commands).indent 2 if commands.any? %>
|
35
|
-
|
36
|
-
if [[ -n $long_usage ]]; then
|
37
|
-
printf "<%= strings[:options] %>\n"
|
38
|
-
<%= render(:usage_fixed_flags).indent 4 %>
|
39
|
-
<%= render(:usage_flags).indent 4 if flags.any? %>
|
40
|
-
<%= render(:usage_args).indent 4 if args.any? or catch_all.help %>
|
41
|
-
<%= render(:usage_environment_variables).indent 4 if environment_variables.any? %>
|
42
|
-
<%= render(:usage_examples).indent 4 if examples %>
|
43
|
-
<%= render(:footer).indent 4 if footer %>
|
44
|
-
|
45
|
-
fi
|
46
|
-
}
|
47
|
-
|
48
|
-
<%- commands.each do |command| -%>
|
49
|
-
<%= command.render 'usage' %>
|
50
|
-
<%- end -%>
|
@@ -1,14 +0,0 @@
|
|
1
|
-
<%= view_marker %>
|
2
|
-
printf "<%= strings[:arguments] %>\n"
|
3
|
-
% if args.any?
|
4
|
-
|
5
|
-
% args.each do |arg|
|
6
|
-
<%= arg.render(:usage) %>
|
7
|
-
% end
|
8
|
-
% end
|
9
|
-
% if catch_all.help
|
10
|
-
|
11
|
-
echo " <%= catch_all.label %>"
|
12
|
-
printf "<%= catch_all.help.wrap(76).indent(4).sanitize_for_print %>\n"
|
13
|
-
echo
|
14
|
-
% end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
<%= view_marker %>
|
2
|
-
% maxlen = command_help_data.values.map(&:keys).flatten.map(&:size).max
|
3
|
-
% command_help_data.each do |group, commands|
|
4
|
-
printf "<%= group %>\n"
|
5
|
-
% commands.each do |command, info|
|
6
|
-
% if info[:help_only]
|
7
|
-
[[ -n $long_usage ]] && echo " <%= command.ljust maxlen %> <%= info[:summary] %>"
|
8
|
-
% else
|
9
|
-
echo " <%= command.ljust maxlen %> <%= info[:summary] %>"
|
10
|
-
% end
|
11
|
-
% end
|
12
|
-
echo
|
13
|
-
% end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
<%= view_marker %>
|
2
|
-
% if short_flag_exist? "-h"
|
3
|
-
echo " --help"
|
4
|
-
% else
|
5
|
-
echo " --help, -h"
|
6
|
-
% end
|
7
|
-
printf " <%= strings[:help_flag_text] %>\n"
|
8
|
-
echo
|
9
|
-
% if root_command?
|
10
|
-
% if short_flag_exist? "-v"
|
11
|
-
echo " --version"
|
12
|
-
% else
|
13
|
-
echo " --version, -v"
|
14
|
-
% end
|
15
|
-
printf " <%= strings[:version_flag_text] %>\n"
|
16
|
-
echo
|
17
|
-
% end
|
@@ -1,33 +0,0 @@
|
|
1
|
-
<%= view_marker %>
|
2
|
-
% whitelisted_args.each do |arg|
|
3
|
-
% if arg.repeatable
|
4
|
-
eval "input_array=(${args[<%= arg.name %>]})"
|
5
|
-
for i in "${input_array[@]}"; do
|
6
|
-
if [[ ! $i =~ ^(<%= arg.allowed.join '|' %>)$ ]]; then
|
7
|
-
printf "%s\n" "<%= strings[:disallowed_argument] % { name: arg.name, allowed: arg.allowed.join(', ') } %>"
|
8
|
-
exit 1
|
9
|
-
fi
|
10
|
-
done
|
11
|
-
% else
|
12
|
-
if [[ ! ${args[<%= arg.name %>]} =~ ^(<%= arg.allowed.join '|' %>)$ ]]; then
|
13
|
-
printf "%s\n" "<%= strings[:disallowed_argument] % { name: arg.name, allowed: arg.allowed.join(', ') } %>"
|
14
|
-
exit 1
|
15
|
-
fi
|
16
|
-
% end
|
17
|
-
% end
|
18
|
-
% whitelisted_flags.each do |flag|
|
19
|
-
% if flag.repeatable
|
20
|
-
eval "input_array=(${args[<%= flag.name %>]})"
|
21
|
-
for i in "${input_array[@]}"; do
|
22
|
-
if [[ ! $i =~ ^(<%= flag.allowed.join '|' %>)$ ]]; then
|
23
|
-
printf "%s\n" "<%= strings[:disallowed_flag] % { name: flag.name, allowed: flag.allowed.join(', ') } %>"
|
24
|
-
exit 1
|
25
|
-
fi
|
26
|
-
done
|
27
|
-
% else
|
28
|
-
if [[ ! ${args[<%= flag.name %>]} =~ ^(<%= flag.allowed.join '|' %>)$ ]]; then
|
29
|
-
printf "%s\n" "<%= strings[:disallowed_flag] % { name: flag.name, allowed: flag.allowed.join(', ') } %>"
|
30
|
-
exit 1
|
31
|
-
fi
|
32
|
-
% end
|
33
|
-
% end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
<%= view_marker %>
|
2
|
-
if [[ -n ${2+x} ]]; then
|
3
|
-
<%= render(:validations).indent 2 %>
|
4
|
-
% if repeatable
|
5
|
-
if [[ -z ${args[<%= name %>]+x} ]]; then
|
6
|
-
args[<%= name %>]="\"$2\""
|
7
|
-
else
|
8
|
-
args[<%= name %>]="${args[<%= name %>]} \"$2\""
|
9
|
-
fi
|
10
|
-
% else
|
11
|
-
args[<%= name %>]="$2"
|
12
|
-
% end
|
13
|
-
shift
|
14
|
-
shift
|
15
|
-
else
|
16
|
-
printf "%s\n" "<%= strings[:flag_requires_an_argument] % { name: name, usage: usage_string } %>"
|
17
|
-
exit 1
|
18
|
-
fi
|
19
|
-
;;
|
@@ -1,18 +0,0 @@
|
|
1
|
-
<%= view_marker %>
|
2
|
-
% if conflicts
|
3
|
-
% if conflicts.count == 1
|
4
|
-
if [[ -n "${args[<%= conflicts.first %>]:-}" ]]; then
|
5
|
-
printf "<%= strings[:conflicting_flags] %>\n" "$key" "<%= conflicts.first %>"
|
6
|
-
exit 1
|
7
|
-
fi
|
8
|
-
|
9
|
-
% else
|
10
|
-
for conflict in <%= conflicts.join ' ' %>; do
|
11
|
-
if [[ -n "${args[$conflict]:-}" ]]; then
|
12
|
-
printf "<%= strings[:conflicting_flags] %>\n" "$key" "$conflict"
|
13
|
-
exit 1
|
14
|
-
fi
|
15
|
-
done
|
16
|
-
|
17
|
-
% end
|
18
|
-
% end
|
@@ -1,10 +0,0 @@
|
|
1
|
-
<%= view_marker %>
|
2
|
-
echo " <%= usage_string extended: true %>"
|
3
|
-
printf "<%= help.wrap(76).indent(4).sanitize_for_print %>\n"
|
4
|
-
% if allowed
|
5
|
-
printf " <%= strings[:allowed] % { values: allowed.join(', ') } -%>\n"
|
6
|
-
% end
|
7
|
-
% if default
|
8
|
-
printf " <%= strings[:default] % { value: default } -%>\n"
|
9
|
-
% end
|
10
|
-
echo
|