bashly 0.9.3 → 0.9.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bashly/commands/doc.rb +1 -1
- data/lib/bashly/commands/validate.rb +2 -0
- data/lib/bashly/extensions/string.rb +8 -0
- data/lib/bashly/settings.rb +5 -1
- data/lib/bashly/templates/settings.yml +12 -0
- data/lib/bashly/version.rb +1 -1
- data/lib/bashly/views/argument/usage.gtx +1 -1
- data/lib/bashly/views/command/long_usage.gtx +1 -1
- data/lib/bashly/views/command/usage.gtx +1 -1
- data/lib/bashly/views/command/usage_args.gtx +1 -1
- data/lib/bashly/views/command/usage_commands.gtx +3 -3
- data/lib/bashly/views/command/usage_environment_variables.gtx +1 -1
- data/lib/bashly/views/command/usage_examples.gtx +1 -1
- data/lib/bashly/views/command/usage_fixed_flags.gtx +11 -2
- data/lib/bashly/views/environment_variable/usage.gtx +1 -1
- data/lib/bashly/views/flag/usage.gtx +1 -1
- data/lib/bashly.rb +0 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 810dfb8f0b25029420a1479aa38d682a79787716112d9b5f9c816533fc3e97ea
|
4
|
+
data.tar.gz: c6782bd0bf01a475b137487dcdec634645484c877386b1ccaaa8432d53831595
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c6cb7413b619b50cd76ecfa66d704623780f05f3316e1e9bcb9e7a3c02a4a3b9a9215759e928e32e4d6492993fb5b5cbcb6ba0379bd0fe638f6ab1182b791a4
|
7
|
+
data.tar.gz: e83491e2a1ab364701351a74bbef05377bbe479521fe907b8f9b1dc3fa567be4f5b53f87c4f4d4dd4313e9fff16ab84e07dd5cbfae5ed7ff0f4c2d44b98d69bd
|
data/lib/bashly/commands/doc.rb
CHANGED
@@ -37,4 +37,12 @@ class String
|
|
37
37
|
"\t" * (::Regexp.last_match(1).size / tabstop)
|
38
38
|
end
|
39
39
|
end
|
40
|
+
|
41
|
+
def color(marker)
|
42
|
+
color = Bashly::Settings.usage_colors[marker.to_s]
|
43
|
+
return self unless color
|
44
|
+
|
45
|
+
text, spaces = match(/(.*?)(\s*)$/).captures
|
46
|
+
%[$(#{color} "#{text}")#{spaces}]
|
47
|
+
end
|
40
48
|
end
|
data/lib/bashly/settings.rb
CHANGED
@@ -4,7 +4,7 @@ module Bashly
|
|
4
4
|
include AssetHelper
|
5
5
|
|
6
6
|
attr_writer :compact_short_flags, :lib_dir, :partials_extension,
|
7
|
-
:source_dir, :strict, :tab_indent, :target_dir
|
7
|
+
:source_dir, :strict, :tab_indent, :target_dir, :usage_colors
|
8
8
|
|
9
9
|
def compact_short_flags
|
10
10
|
@compact_short_flags ||= get :compact_short_flags
|
@@ -50,6 +50,10 @@ module Bashly
|
|
50
50
|
@target_dir ||= get :target_dir
|
51
51
|
end
|
52
52
|
|
53
|
+
def usage_colors
|
54
|
+
@usage_colors ||= get :usage_colors
|
55
|
+
end
|
56
|
+
|
53
57
|
private
|
54
58
|
|
55
59
|
def get(key)
|
@@ -33,3 +33,15 @@ env: development
|
|
33
33
|
|
34
34
|
# The extension to use when reading/writing partial script snippets.
|
35
35
|
partials_extension: sh
|
36
|
+
|
37
|
+
# Display various usage elements in color by providing the name of the color
|
38
|
+
# function. The value for each property is a name of a function that is
|
39
|
+
# available in your script, for example: `green` or `bold`.
|
40
|
+
# You can run `bashly add colors` to add a standard colors library.
|
41
|
+
# This option cannot be set via environment variables.
|
42
|
+
usage_colors:
|
43
|
+
caption: ~
|
44
|
+
command: ~
|
45
|
+
arg: ~
|
46
|
+
flag: ~
|
47
|
+
environment_variable: ~
|
data/lib/bashly/version.rb
CHANGED
@@ -3,13 +3,13 @@
|
|
3
3
|
maxlen = command_help_data.values.map(&:keys).flatten.map(&:size).max
|
4
4
|
|
5
5
|
command_help_data.each do |group, commands|
|
6
|
-
> printf "{{ group }}
|
6
|
+
> printf "%s\n" "{{ group.color(:caption) }}"
|
7
7
|
|
8
8
|
commands.each do |command, info|
|
9
9
|
if info[:help_only]
|
10
|
-
> [[ -n $long_usage ]] &&
|
10
|
+
> [[ -n $long_usage ]] && printf " %s {{ info[:summary] }}\n" "{{ command.ljust(maxlen).color(:command) }}"
|
11
11
|
else
|
12
|
-
>
|
12
|
+
> printf " %s {{ info[:summary] }}\n" "{{ command.ljust(maxlen).color(:command) }}"
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
@@ -1,11 +1,20 @@
|
|
1
1
|
= view_marker
|
2
2
|
|
3
|
-
|
3
|
+
if short_flag_exist?("-h")
|
4
|
+
> printf " %s\n" "{{ '--help'.color(:flag) }}"
|
5
|
+
else
|
6
|
+
> printf " %s\n" "{{ '--help, -h'.color(:flag) }}"
|
7
|
+
end
|
8
|
+
|
4
9
|
> printf " {{ strings[:help_flag_text] }}\n"
|
5
10
|
> echo
|
6
11
|
|
7
12
|
if root_command?
|
8
|
-
|
13
|
+
if short_flag_exist?("-v")
|
14
|
+
> printf " %s\n" "{{ '--version'.color(:flag) }}"
|
15
|
+
else
|
16
|
+
> printf " %s\n" "{{ '--version, -v'.color(:flag) }}"
|
17
|
+
end
|
9
18
|
> printf " {{ strings[:version_flag_text] }}\n"
|
10
19
|
> echo
|
11
20
|
end
|
data/lib/bashly.rb
CHANGED
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: 0.9.
|
4
|
+
version: 0.9.4
|
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: 2022-12-
|
11
|
+
date: 2022-12-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: completely
|
@@ -100,14 +100,14 @@ dependencies:
|
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: '0
|
103
|
+
version: '1.0'
|
104
104
|
type: :runtime
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: '0
|
110
|
+
version: '1.0'
|
111
111
|
description: Generate bash command line tools using YAML configuration
|
112
112
|
email: db@dannyben.com
|
113
113
|
executables:
|