bashly 1.3.7 → 1.3.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/bashly/libraries/settings/settings.yml +6 -0
- data/lib/bashly/script/introspection/commands.rb +0 -5
- data/lib/bashly/settings.rb +5 -0
- data/lib/bashly/version.rb +1 -1
- data/lib/bashly/views/command/argfile_filter.gtx +26 -2
- data/lib/bashly/views/command/master_script.gtx +0 -1
- data/lib/bashly/views/command/parse_requirements.gtx +1 -1
- data/lib/bashly/views/flag/argfile_case.gtx +6 -0
- data/lib/bashly/views/flag/argfile_case_arg.gtx +23 -0
- data/lib/bashly/views/flag/argfile_case_no_arg.gtx +7 -0
- metadata +4 -2
- data/lib/bashly/views/command/argfile_helpers.gtx +0 -36
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 411dc6262c3232175e5a968a31ad90b56aa59be9d9b46203c3eb2db14f35d491
|
|
4
|
+
data.tar.gz: 2ce20d069c93e1e7081984ff1fb2dd9c7bca530d6fbf127e0bb1c996c0117cc1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3bff0a363b5c52c0f54b2b1e413b909256579c0b29ef8a44e88cd73b1803c584c3de26af99fa737edac8cc103a218f418a7a5f463e38b27c416ebf26bbcfe8ef
|
|
7
|
+
data.tar.gz: 2691947ed69d6f693625be4ba66a1b9803d01e46f50768d266c5f0f27c60f74242977fb91131443f6bd29161a9810970b542ecef3d3be0e9b3a84641da8dc080
|
|
@@ -120,6 +120,12 @@ show_examples_on_error: false
|
|
|
120
120
|
# all the private elements in the usage texts, as if they were public.
|
|
121
121
|
private_reveal_key: ~
|
|
122
122
|
|
|
123
|
+
# When enabling argfile for any command, this setting controls the name of the
|
|
124
|
+
# environment variable that can override or disable argfile loading at runtime.
|
|
125
|
+
# Set the variable to `0`, `off`, `no` or `false` to disable argfile loading,
|
|
126
|
+
# or to a different path to load another argfile instead.
|
|
127
|
+
argfile_var: ARGFILE
|
|
128
|
+
|
|
123
129
|
# Display various usage elements in color by providing the name of the color
|
|
124
130
|
# function. The value for each property is a name of a function that is
|
|
125
131
|
# available in your script, for example: `green` or `bold`.
|
|
@@ -7,11 +7,6 @@ module Bashly
|
|
|
7
7
|
deep_commands(include_self: true).any? { |x| x.catch_all.enabled? }
|
|
8
8
|
end
|
|
9
9
|
|
|
10
|
-
# Returns true if the command or any of its descendants has `argfile`
|
|
11
|
-
def argfile_used_anywhere?
|
|
12
|
-
deep_commands(include_self: true).any?(&:argfile)
|
|
13
|
-
end
|
|
14
|
-
|
|
15
10
|
# Returns a full list of the Command names and aliases combined
|
|
16
11
|
def command_aliases
|
|
17
12
|
commands.map(&:aliases).flatten
|
data/lib/bashly/settings.rb
CHANGED
|
@@ -4,6 +4,7 @@ module Bashly
|
|
|
4
4
|
include AssetHelper
|
|
5
5
|
|
|
6
6
|
attr_writer(
|
|
7
|
+
:argfile_var,
|
|
7
8
|
:commands_dir,
|
|
8
9
|
:compact_short_flags,
|
|
9
10
|
:conjoined_flag_args,
|
|
@@ -37,6 +38,10 @@ module Bashly
|
|
|
37
38
|
@all_lib_dirs = [full_lib_dir] + extra_lib_dirs
|
|
38
39
|
end
|
|
39
40
|
|
|
41
|
+
def argfile_var
|
|
42
|
+
@argfile_var ||= get :argfile_var
|
|
43
|
+
end
|
|
44
|
+
|
|
40
45
|
def commands_dir
|
|
41
46
|
@commands_dir ||= get :commands_dir
|
|
42
47
|
end
|
data/lib/bashly/version.rb
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
= view_marker
|
|
2
2
|
|
|
3
|
-
>
|
|
4
|
-
>
|
|
3
|
+
> local argfile argfile_line argfile_key argfile_value env_argfile env_argfile_var
|
|
4
|
+
> argfile="{{ argfile }}"
|
|
5
|
+
> env_argfile_var="{{ Settings.argfile_var }}"
|
|
6
|
+
> env_argfile="${!env_argfile_var:-}"
|
|
7
|
+
>
|
|
8
|
+
> case "${env_argfile,,}" in
|
|
9
|
+
> 0 | off | no | false)
|
|
10
|
+
> argfile=''
|
|
11
|
+
> ;;
|
|
12
|
+
> esac
|
|
13
|
+
>
|
|
14
|
+
> [[ -n "$env_argfile" ]] && argfile="$env_argfile"
|
|
15
|
+
> if [[ -f "$argfile" ]]; then
|
|
16
|
+
> while IFS= read -r argfile_line || [[ -n "$argfile_line" ]]; do
|
|
17
|
+
> [[ "$argfile_line" =~ ^[[:space:]]*(-{1,2}[^[:space:]]+)([[:space:]]+(.+))?[[:space:]]*$ ]] || continue
|
|
18
|
+
> argfile_key="${BASH_REMATCH[1]}"
|
|
19
|
+
> argfile_value="${BASH_REMATCH[3]:-}"
|
|
20
|
+
> argfile_value="${argfile_value#"${argfile_value%%[![:space:]]*}"}"
|
|
21
|
+
> argfile_value="${argfile_value%"${argfile_value##*[![:space:]]}"}"
|
|
22
|
+
> [[ "$argfile_value" =~ ^\"(.*)\"$ || "$argfile_value" =~ ^\'(.*)\'$ ]] && argfile_value="${BASH_REMATCH[1]}"
|
|
23
|
+
>
|
|
24
|
+
> case "$argfile_key" in
|
|
25
|
+
= flags.map { |flag| flag.render(:argfile_case) }.join.indent 6
|
|
26
|
+
> esac
|
|
27
|
+
> done <"$argfile"
|
|
28
|
+
> fi
|
|
5
29
|
>
|
|
@@ -8,8 +8,8 @@ end
|
|
|
8
8
|
> local key
|
|
9
9
|
>
|
|
10
10
|
|
|
11
|
-
= render(:argfile_filter).indent 2 if argfile
|
|
12
11
|
= render(:fixed_flags_filter).indent 2
|
|
12
|
+
= render(:argfile_filter).indent 2 if argfile
|
|
13
13
|
= render(:environment_variables_filter).indent 2
|
|
14
14
|
= render(:dependencies_filter).indent 2
|
|
15
15
|
= render(:command_filter).indent 2
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
= view_marker
|
|
2
|
+
|
|
3
|
+
> if [[ -n "$argfile_value" ]]; then
|
|
4
|
+
|
|
5
|
+
if repeatable
|
|
6
|
+
> escaped="$(printf '%q' "$argfile_value")"
|
|
7
|
+
> if [[ -z ${args['{{ name }}']+x} ]]; then
|
|
8
|
+
> args['{{ name }}']="$escaped"
|
|
9
|
+
if unique
|
|
10
|
+
> unique_lookup["{{ name }}:$escaped"]=1
|
|
11
|
+
> elif [[ -z "${unique_lookup["{{ name }}:$escaped"]:-}" ]]; then
|
|
12
|
+
> args['{{ name }}']="${args['{{ name }}']} $escaped"
|
|
13
|
+
> unique_lookup["{{ name }}:$escaped"]=1
|
|
14
|
+
else
|
|
15
|
+
> else
|
|
16
|
+
> args['{{ name }}']="${args['{{ name }}']} $escaped"
|
|
17
|
+
end
|
|
18
|
+
> fi
|
|
19
|
+
else
|
|
20
|
+
> [[ -n ${args['{{ name }}']+x} ]] || args['{{ name }}']="$argfile_value"
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
> fi
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: bashly
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.3.
|
|
4
|
+
version: 1.3.8
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Danny Ben Shitrit
|
|
@@ -247,7 +247,6 @@ files:
|
|
|
247
247
|
- lib/bashly/views/argument/usage.gtx
|
|
248
248
|
- lib/bashly/views/argument/validations.gtx
|
|
249
249
|
- lib/bashly/views/command/argfile_filter.gtx
|
|
250
|
-
- lib/bashly/views/command/argfile_helpers.gtx
|
|
251
250
|
- lib/bashly/views/command/catch_all_filter.gtx
|
|
252
251
|
- lib/bashly/views/command/command_fallback.gtx
|
|
253
252
|
- lib/bashly/views/command/command_filter.gtx
|
|
@@ -299,6 +298,9 @@ files:
|
|
|
299
298
|
- lib/bashly/views/dependency/filter.gtx
|
|
300
299
|
- lib/bashly/views/environment_variable/usage.gtx
|
|
301
300
|
- lib/bashly/views/environment_variable/validations.gtx
|
|
301
|
+
- lib/bashly/views/flag/argfile_case.gtx
|
|
302
|
+
- lib/bashly/views/flag/argfile_case_arg.gtx
|
|
303
|
+
- lib/bashly/views/flag/argfile_case_no_arg.gtx
|
|
302
304
|
- lib/bashly/views/flag/case.gtx
|
|
303
305
|
- lib/bashly/views/flag/case_arg.gtx
|
|
304
306
|
- lib/bashly/views/flag/case_no_arg.gtx
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
= view_marker
|
|
2
|
-
|
|
3
|
-
> load_command_argfile() {
|
|
4
|
-
> local argfile_path line arg
|
|
5
|
-
> argfile_path="$1"
|
|
6
|
-
> shift
|
|
7
|
-
> argfile_input=()
|
|
8
|
-
>
|
|
9
|
-
> if [[ ! -f "$argfile_path" ]]; then
|
|
10
|
-
> argfile_input=("$@")
|
|
11
|
-
> return
|
|
12
|
-
> fi
|
|
13
|
-
>
|
|
14
|
-
> while IFS= read -r line || [[ -n "$line" ]]; do
|
|
15
|
-
> line="${line#"${line%%[![:space:]]*}"}"
|
|
16
|
-
> line="${line%"${line##*[![:space:]]}"}"
|
|
17
|
-
>
|
|
18
|
-
> [[ -z "$line" || "${line:0:1}" == "#" ]] && continue
|
|
19
|
-
>
|
|
20
|
-
> if [[ "$line" =~ ^(-{1,2}[^[:space:]]+)[[:space:]]+(.+)$ ]]; then
|
|
21
|
-
> for arg in "${BASH_REMATCH[1]}" "${BASH_REMATCH[2]}"; do
|
|
22
|
-
> arg="${arg#"${arg%%[![:space:]]*}"}"
|
|
23
|
-
> arg="${arg%"${arg##*[![:space:]]}"}"
|
|
24
|
-
> [[ "$arg" =~ ^\"(.*)\"$ || "$arg" =~ ^\'(.*)\'$ ]] && arg="${BASH_REMATCH[1]}"
|
|
25
|
-
> argfile_input+=("$arg")
|
|
26
|
-
> done
|
|
27
|
-
> else
|
|
28
|
-
> arg="$line"
|
|
29
|
-
> [[ "$arg" =~ ^\"(.*)\"$ || "$arg" =~ ^\'(.*)\'$ ]] && arg="${BASH_REMATCH[1]}"
|
|
30
|
-
> argfile_input+=("$arg")
|
|
31
|
-
> fi
|
|
32
|
-
> done <"$argfile_path"
|
|
33
|
-
>
|
|
34
|
-
> argfile_input+=("$@")
|
|
35
|
-
> }
|
|
36
|
-
>
|