bashly 1.1.9 → 1.1.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bashly/extensions/string.rb +1 -1
- data/lib/bashly/libraries/settings/settings.yml +5 -0
- data/lib/bashly/script/base.rb +1 -1
- data/lib/bashly/script/catch_all.rb +1 -1
- data/lib/bashly/settings.rb +5 -0
- data/lib/bashly/version.rb +1 -1
- data/lib/bashly/views/command/normalize_input.gtx +4 -27
- data/lib/bashly/views/command/normalize_input_function.gtx +39 -0
- data/lib/bashly/views/command/normalize_input_simple.gtx +6 -0
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '0857ce9cc52b919c113242568610ed9abbd447221b6d473bbf05f1cd8f29de69'
|
4
|
+
data.tar.gz: 3eb8279ffdbf23a69a5c7eb52d98f2f0c3ca1730f54eb6a18b4957038b69810a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2aa95822cebdc83d0e3a1af47a2d75886994a7d79976188049b8ea6732ca3d6a83003bfea48c3789e8d3a4db562e16f8f9ed169da414065567c7abf2d2d4c40b
|
7
|
+
data.tar.gz: 3cf237064dfe7f9cfb2523c85d838141f9869e246619b9ed2bf9862499a0345ea1da12178802ee6d7a654e1ad8fec674b751442566b8b8ca1e22b77055105fd1
|
@@ -42,6 +42,11 @@ tab_indent: false
|
|
42
42
|
# `-abc` as if it is `-a -b -c`.
|
43
43
|
compact_short_flags: true
|
44
44
|
|
45
|
+
# When true, the generated script will consider any argument in the form of
|
46
|
+
# `--flag=value` and `-f=value` as if it is `--flag value` and `-f value`
|
47
|
+
# respectively.
|
48
|
+
conjoined_flag_args: true
|
49
|
+
|
45
50
|
# Set to 'production' or 'development':
|
46
51
|
# env: production Generate a smaller script, without file markers
|
47
52
|
# env: development Generate with file markers
|
data/lib/bashly/script/base.rb
CHANGED
data/lib/bashly/settings.rb
CHANGED
@@ -6,6 +6,7 @@ module Bashly
|
|
6
6
|
attr_writer(
|
7
7
|
:commands_dir,
|
8
8
|
:compact_short_flags,
|
9
|
+
:conjoined_flag_args,
|
9
10
|
:config_path,
|
10
11
|
:lib_dir,
|
11
12
|
:partials_extension,
|
@@ -24,6 +25,10 @@ module Bashly
|
|
24
25
|
@compact_short_flags ||= get :compact_short_flags
|
25
26
|
end
|
26
27
|
|
28
|
+
def conjoined_flag_args
|
29
|
+
@conjoined_flag_args ||= get :conjoined_flag_args
|
30
|
+
end
|
31
|
+
|
27
32
|
def config_path
|
28
33
|
@config_path ||= get(:config_path) % { source_dir: source_dir }
|
29
34
|
end
|
data/lib/bashly/version.rb
CHANGED
@@ -1,30 +1,7 @@
|
|
1
1
|
= view_marker
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
> arg="$1"
|
8
|
-
> if [[ $arg =~ ^(--[a-zA-Z0-9_\-]+)=(.+)$ ]]; then
|
9
|
-
> input+=("${BASH_REMATCH[1]}")
|
10
|
-
> input+=("${BASH_REMATCH[2]}")
|
11
|
-
> elif [[ $arg =~ ^(-[a-zA-Z0-9])=(.+)$ ]]; then
|
12
|
-
> input+=("${BASH_REMATCH[1]}")
|
13
|
-
> input+=("${BASH_REMATCH[2]}")
|
14
|
-
|
15
|
-
if Settings.compact_short_flags
|
16
|
-
> elif [[ $arg =~ ^-([a-zA-Z0-9][a-zA-Z0-9]+)$ ]]; then
|
17
|
-
> flags="${BASH_REMATCH[1]}"
|
18
|
-
> for ((i = 0; i < ${#flags}; i++)); do
|
19
|
-
> input+=("-${flags:i:1}")
|
20
|
-
> done
|
3
|
+
if Settings.compact_short_flags || Settings.conjoined_flag_args
|
4
|
+
= render :normalize_input_function
|
5
|
+
else
|
6
|
+
= render :normalize_input_simple
|
21
7
|
end
|
22
|
-
|
23
|
-
> else
|
24
|
-
> input+=("$arg")
|
25
|
-
> fi
|
26
|
-
>
|
27
|
-
> shift
|
28
|
-
> done
|
29
|
-
> }
|
30
|
-
>
|
@@ -0,0 +1,39 @@
|
|
1
|
+
= view_marker
|
2
|
+
|
3
|
+
> normalize_input() {
|
4
|
+
> local arg flags passthru
|
5
|
+
> passthru=false
|
6
|
+
>
|
7
|
+
> while [[ $# -gt 0 ]]; do
|
8
|
+
> arg="$1"
|
9
|
+
> if [[ $passthru == true ]]; then
|
10
|
+
> input+=("$arg")
|
11
|
+
|
12
|
+
if Settings.conjoined_flag_args
|
13
|
+
> elif [[ $arg =~ ^(--[a-zA-Z0-9_\-]+)=(.+)$ ]]; then
|
14
|
+
> input+=("${BASH_REMATCH[1]}")
|
15
|
+
> input+=("${BASH_REMATCH[2]}")
|
16
|
+
> elif [[ $arg =~ ^(-[a-zA-Z0-9])=(.+)$ ]]; then
|
17
|
+
> input+=("${BASH_REMATCH[1]}")
|
18
|
+
> input+=("${BASH_REMATCH[2]}")
|
19
|
+
end
|
20
|
+
|
21
|
+
if Settings.compact_short_flags
|
22
|
+
> elif [[ $arg =~ ^-([a-zA-Z0-9][a-zA-Z0-9]+)$ ]]; then
|
23
|
+
> flags="${BASH_REMATCH[1]}"
|
24
|
+
> for ((i = 0; i < ${#flags}; i++)); do
|
25
|
+
> input+=("-${flags:i:1}")
|
26
|
+
> done
|
27
|
+
end
|
28
|
+
|
29
|
+
> elif [[ "$arg" == "--" ]]; then
|
30
|
+
> passthru=true
|
31
|
+
> input+=("$arg")
|
32
|
+
> else
|
33
|
+
> input+=("$arg")
|
34
|
+
> fi
|
35
|
+
>
|
36
|
+
> shift
|
37
|
+
> done
|
38
|
+
> }
|
39
|
+
>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bashly
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Danny Ben Shitrit
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-04-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colsole
|
@@ -248,6 +248,8 @@ files:
|
|
248
248
|
- lib/bashly/views/command/long_usage.gtx
|
249
249
|
- lib/bashly/views/command/master_script.gtx
|
250
250
|
- lib/bashly/views/command/normalize_input.gtx
|
251
|
+
- lib/bashly/views/command/normalize_input_function.gtx
|
252
|
+
- lib/bashly/views/command/normalize_input_simple.gtx
|
251
253
|
- lib/bashly/views/command/parse_requirements.gtx
|
252
254
|
- lib/bashly/views/command/parse_requirements_case.gtx
|
253
255
|
- lib/bashly/views/command/parse_requirements_case_catch_all.gtx
|
@@ -298,7 +300,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
298
300
|
requirements:
|
299
301
|
- - ">="
|
300
302
|
- !ruby/object:Gem::Version
|
301
|
-
version: '3.
|
303
|
+
version: '3.1'
|
302
304
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
303
305
|
requirements:
|
304
306
|
- - ">="
|