bashly 1.3.7 → 1.4.0.rc1
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/commands/doc.rb +1 -1
- data/lib/bashly/completion_builder.rb +188 -0
- data/lib/bashly/completions/bashly-completions.bash +482 -78
- data/lib/bashly/completions/completely.yaml +141 -155
- data/lib/bashly/completions/completely.yaml.gtx +62 -75
- data/lib/bashly/concerns/completions.rb +9 -46
- data/lib/bashly/config_validator.rb +3 -0
- data/lib/bashly/docs/arg.yml +11 -0
- data/lib/bashly/extensions/yaml.rb +12 -5
- data/lib/bashly/libraries/libraries.yml +15 -0
- data/lib/bashly/libraries/settings/settings.yml +6 -0
- data/lib/bashly/library_source_config.rb +1 -1
- data/lib/bashly/message_strings.rb +2 -2
- data/lib/bashly/script/argument.rb +1 -1
- data/lib/bashly/script/dependency.rb +1 -1
- 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
- data/lib/bashly.rb +3 -2
- metadata +8 -5
- data/lib/bashly/views/command/argfile_helpers.gtx +0 -36
|
@@ -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
|
data/lib/bashly.rb
CHANGED
|
@@ -6,8 +6,9 @@ module Bashly
|
|
|
6
6
|
autoloads 'bashly/refinements', %i[ComposeRefinements]
|
|
7
7
|
|
|
8
8
|
autoloads 'bashly', %i[
|
|
9
|
-
CLI Config ConfigValidator Library LibrarySource
|
|
10
|
-
MessageStrings RenderContext RenderSource Settings
|
|
9
|
+
CLI CompletionBuilder Config ConfigValidator Library LibrarySource
|
|
10
|
+
LibrarySourceConfig MessageStrings RenderContext RenderSource Settings
|
|
11
|
+
VERSION Watch
|
|
11
12
|
]
|
|
12
13
|
|
|
13
14
|
autoloads 'bashly/concerns', %i[
|
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.
|
|
4
|
+
version: 1.4.0.rc1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Danny Ben Shitrit
|
|
@@ -29,14 +29,14 @@ dependencies:
|
|
|
29
29
|
requirements:
|
|
30
30
|
- - "~>"
|
|
31
31
|
- !ruby/object:Gem::Version
|
|
32
|
-
version: 0.
|
|
32
|
+
version: 0.8.0.rc4
|
|
33
33
|
type: :runtime
|
|
34
34
|
prerelease: false
|
|
35
35
|
version_requirements: !ruby/object:Gem::Requirement
|
|
36
36
|
requirements:
|
|
37
37
|
- - "~>"
|
|
38
38
|
- !ruby/object:Gem::Version
|
|
39
|
-
version: 0.
|
|
39
|
+
version: 0.8.0.rc4
|
|
40
40
|
- !ruby/object:Gem::Dependency
|
|
41
41
|
name: gtx
|
|
42
42
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -156,6 +156,7 @@ files:
|
|
|
156
156
|
- lib/bashly/commands/render.rb
|
|
157
157
|
- lib/bashly/commands/shell.rb
|
|
158
158
|
- lib/bashly/commands/validate.rb
|
|
159
|
+
- lib/bashly/completion_builder.rb
|
|
159
160
|
- lib/bashly/completions/README.md
|
|
160
161
|
- lib/bashly/completions/bashly-completions.bash
|
|
161
162
|
- lib/bashly/completions/completely.yaml
|
|
@@ -247,7 +248,6 @@ files:
|
|
|
247
248
|
- lib/bashly/views/argument/usage.gtx
|
|
248
249
|
- lib/bashly/views/argument/validations.gtx
|
|
249
250
|
- lib/bashly/views/command/argfile_filter.gtx
|
|
250
|
-
- lib/bashly/views/command/argfile_helpers.gtx
|
|
251
251
|
- lib/bashly/views/command/catch_all_filter.gtx
|
|
252
252
|
- lib/bashly/views/command/command_fallback.gtx
|
|
253
253
|
- lib/bashly/views/command/command_filter.gtx
|
|
@@ -299,6 +299,9 @@ files:
|
|
|
299
299
|
- lib/bashly/views/dependency/filter.gtx
|
|
300
300
|
- lib/bashly/views/environment_variable/usage.gtx
|
|
301
301
|
- lib/bashly/views/environment_variable/validations.gtx
|
|
302
|
+
- lib/bashly/views/flag/argfile_case.gtx
|
|
303
|
+
- lib/bashly/views/flag/argfile_case_arg.gtx
|
|
304
|
+
- lib/bashly/views/flag/argfile_case_no_arg.gtx
|
|
302
305
|
- lib/bashly/views/flag/case.gtx
|
|
303
306
|
- lib/bashly/views/flag/case_arg.gtx
|
|
304
307
|
- lib/bashly/views/flag/case_no_arg.gtx
|
|
@@ -334,7 +337,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
334
337
|
- !ruby/object:Gem::Version
|
|
335
338
|
version: '0'
|
|
336
339
|
requirements: []
|
|
337
|
-
rubygems_version: 4.0.
|
|
340
|
+
rubygems_version: 4.0.15
|
|
338
341
|
specification_version: 4
|
|
339
342
|
summary: Bash Command Line Tool Generator
|
|
340
343
|
test_files: []
|
|
@@ -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
|
-
>
|