bashly 0.3.1 → 0.3.2
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/add.rb +1 -1
- data/lib/bashly/commands/generate.rb +1 -1
- data/lib/bashly/templates/lib/colors.sh +20 -20
- data/lib/bashly/templates/lib/config.sh +2 -2
- data/lib/bashly/templates/strings.yml +2 -2
- data/lib/bashly/version.rb +1 -1
- data/lib/bashly/views/argument/usage.erb +1 -1
- data/lib/bashly/views/command/dependencies_filter.erb +1 -1
- data/lib/bashly/views/command/environment_variables_filter.erb +1 -1
- data/lib/bashly/views/command/parse_requirements_case.erb +2 -2
- data/lib/bashly/views/command/parse_requirements_while.erb +1 -1
- data/lib/bashly/views/command/required_args_filter.erb +1 -1
- data/lib/bashly/views/command/required_flags_filter.erb +1 -1
- data/lib/bashly/views/command/usage.erb +10 -10
- data/lib/bashly/views/command/usage_args.erb +1 -1
- data/lib/bashly/views/command/usage_commands.erb +1 -1
- data/lib/bashly/views/command/usage_environment_variables.erb +1 -1
- data/lib/bashly/views/command/usage_examples.erb +2 -2
- data/lib/bashly/views/command/usage_fixed_flags.erb +2 -2
- data/lib/bashly/views/environment_variable/usage.erb +1 -1
- data/lib/bashly/views/flag/case.erb +1 -1
- data/lib/bashly/views/flag/usage.erb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 665f22f00a1ebc72e1d6e549cfea6030410a386a9375f39734a00e4091290e89
|
4
|
+
data.tar.gz: 7e2a7b0afb183f1103d7a789fa6955e7520b63505130e764b91b14a3d3e15235
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 77d14c4d2ce85b462aea89a4cce5aadef3bf70ca6373bf782b58bedcf17fcd52d2fbe2bfd26569d9c0a03fecea2a1eec8c630eec51003438bdf8fe099b28bf3e
|
7
|
+
data.tar.gz: c6b803f2390630053483ca5507df869c95f0fa50752d3f3cf9595807a5779b01724c99460ee8bf0c5a258959769100199a5876bafe62430189e925d697abd979
|
data/lib/bashly/commands/add.rb
CHANGED
@@ -18,7 +18,7 @@ module Bashly
|
|
18
18
|
command "colors", "Add standard functions for printing colorful and formatted text to the lib directory."
|
19
19
|
command "yaml", "Add standard functions for reading YAML files to the lib directory."
|
20
20
|
|
21
|
-
environment "BASHLY_SOURCE_DIR", "The path
|
21
|
+
environment "BASHLY_SOURCE_DIR", "The path containing the bashly configuration and source files [default: src]"
|
22
22
|
|
23
23
|
def strings_command
|
24
24
|
safe_copy asset("templates/strings.yml"), "#{Settings.source_dir}/bashly-strings.yml"
|
@@ -8,7 +8,7 @@ module Bashly
|
|
8
8
|
|
9
9
|
option "-f --force", "Overwrite existing files"
|
10
10
|
|
11
|
-
environment "BASHLY_SOURCE_DIR", "The path
|
11
|
+
environment "BASHLY_SOURCE_DIR", "The path containing the bashly configuration and source files [default: src]"
|
12
12
|
environment "BASHLY_TARGET_DIR", "The path to use for creating the bash script [default: .]"
|
13
13
|
|
14
14
|
def run
|
@@ -10,23 +10,23 @@
|
|
10
10
|
#
|
11
11
|
# ---
|
12
12
|
|
13
|
-
red() {
|
14
|
-
green() {
|
15
|
-
yellow() {
|
16
|
-
blue() {
|
17
|
-
magenta() {
|
18
|
-
cyan() {
|
19
|
-
bold() {
|
20
|
-
underlined() {
|
21
|
-
red_bold() {
|
22
|
-
green_bold() {
|
23
|
-
yellow_bold() {
|
24
|
-
blue_bold() {
|
25
|
-
magenta_bold() {
|
26
|
-
cyan_bold() {
|
27
|
-
red_underlined() {
|
28
|
-
green_underlined() {
|
29
|
-
yellow_underlined() {
|
30
|
-
blue_underlined() {
|
31
|
-
magenta_underlined() {
|
32
|
-
cyan_underlined() {
|
13
|
+
red() { printf "\e[31m%b\e[0m\n" "$*"; }
|
14
|
+
green() { printf "\e[32m%b\e[0m\n" "$*"; }
|
15
|
+
yellow() { printf "\e[33m%b\e[0m\n" "$*"; }
|
16
|
+
blue() { printf "\e[34m%b\e[0m\n" "$*"; }
|
17
|
+
magenta() { printf "\e[35m%b\e[0m\n" "$*"; }
|
18
|
+
cyan() { printf "\e[36m%b\e[0m\n" "$*"; }
|
19
|
+
bold() { printf "\e[1m%b\e[0m\n" "$*"; }
|
20
|
+
underlined() { printf "\e[4m%b\e[0m\n" "$*"; }
|
21
|
+
red_bold() { printf "\e[1;31m%b\e[0m\n" "$*"; }
|
22
|
+
green_bold() { printf "\e[1;32m%b\e[0m\n" "$*"; }
|
23
|
+
yellow_bold() { printf "\e[1;33m%b\e[0m\n" "$*"; }
|
24
|
+
blue_bold() { printf "\e[1;34m%b\e[0m\n" "$*"; }
|
25
|
+
magenta_bold() { printf "\e[1;35m%b\e[0m\n" "$*"; }
|
26
|
+
cyan_bold() { printf "\e[1;36m%b\e[0m\n" "$*"; }
|
27
|
+
red_underlined() { printf "\e[4;31m%b\e[0m\n" "$*"; }
|
28
|
+
green_underlined() { printf "\e[4;32m%b\e[0m\n" "$*"; }
|
29
|
+
yellow_underlined() { printf "\e[4;33m%b\e[0m\n" "$*"; }
|
30
|
+
blue_underlined() { printf "\e[4;34m%b\e[0m\n" "$*"; }
|
31
|
+
magenta_underlined() { printf "\e[4;35m%b\e[0m\n" "$*"; }
|
32
|
+
cyan_underlined() { printf "\e[4;36m%b\e[0m\n" "$*"; }
|
@@ -63,7 +63,7 @@ config_set() {
|
|
63
63
|
output="$output$key = $value\n"
|
64
64
|
fi
|
65
65
|
|
66
|
-
|
66
|
+
printf "%b\n" "$output" > "$CONFIG_FILE"
|
67
67
|
}
|
68
68
|
|
69
69
|
# Delete a key from teh config.
|
@@ -83,7 +83,7 @@ config_del() {
|
|
83
83
|
fi
|
84
84
|
done < "$CONFIG_FILE"
|
85
85
|
|
86
|
-
|
86
|
+
printf "%b\n" "$output" > "$CONFIG_FILE"
|
87
87
|
}
|
88
88
|
|
89
89
|
# Show the config file
|
@@ -12,8 +12,8 @@ version_flag_text: Show version number
|
|
12
12
|
|
13
13
|
# Error messages
|
14
14
|
flag_requires_an_argument: "%{long} requires an argument: %{usage}"
|
15
|
-
invalid_argument: "invalid argument: %
|
16
|
-
invalid_flag: "invalid option: %
|
15
|
+
invalid_argument: "invalid argument: %s"
|
16
|
+
invalid_flag: "invalid option: %s"
|
17
17
|
missing_required_argument: "missing required argument: %{arg}\\nusage: %{usage}"
|
18
18
|
missing_required_flag: "missing required flag: %{usage}"
|
19
19
|
missing_required_environment_variable: "missing required environment variable: %{var}"
|
data/lib/bashly/version.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
<%- if dependencies -%>
|
3
3
|
<%- dependencies.each do |dependency| -%>
|
4
4
|
if ! [[ -x "$(command -v <%= dependency %>)" ]]; then
|
5
|
-
|
5
|
+
printf "<%= strings[:missing_dependency] % { dependency: dependency } -%>\n"
|
6
6
|
exit 1
|
7
7
|
fi
|
8
8
|
<%- end -%>
|
@@ -2,7 +2,7 @@
|
|
2
2
|
<%- if required_environment_variables.any? -%>
|
3
3
|
<%- required_environment_variables.each do |env_var| -%>
|
4
4
|
if [[ -z "$<%= env_var.name.upcase %>" ]]; then
|
5
|
-
|
5
|
+
printf "<%= strings[:missing_required_environment_variable] % { var: env_var.name.upcase } -%>\n"
|
6
6
|
exit 1
|
7
7
|
fi
|
8
8
|
<%- end -%>
|
@@ -8,10 +8,10 @@
|
|
8
8
|
<%- condition = "elif" -%>
|
9
9
|
<%- end -%>
|
10
10
|
else
|
11
|
-
|
11
|
+
printf "<%= strings[:invalid_argument] %>\n" "$key"
|
12
12
|
exit 1
|
13
13
|
fi
|
14
14
|
<%- else -%>
|
15
|
-
|
15
|
+
printf "<%= strings[:invalid_argument] %>\n" "$key"
|
16
16
|
exit 1
|
17
17
|
<%- end -%>
|
@@ -4,7 +4,7 @@ if [[ $1 && $1 != -* ]]; then
|
|
4
4
|
args[<%= arg.name %>]=$1
|
5
5
|
shift
|
6
6
|
else
|
7
|
-
|
7
|
+
printf "<%= strings[:missing_required_argument] % { arg: arg.name.upcase, usage: usage_string } %>\n"
|
8
8
|
exit 1
|
9
9
|
fi
|
10
10
|
|
@@ -4,7 +4,7 @@ argstring="$*"
|
|
4
4
|
<%- end -%>
|
5
5
|
<%- required_flags.each do |flag| -%>
|
6
6
|
if [[ <%= flag.aliases.map { |a| %Q["$argstring" != *#{a}*] }.join " && " %> ]]; then
|
7
|
-
|
7
|
+
printf "<%= strings[:missing_required_flag] % { usage: flag.usage_string } %>\n"
|
8
8
|
exit 1
|
9
9
|
fi
|
10
10
|
<%- end %>
|
@@ -2,33 +2,33 @@
|
|
2
2
|
<%= function_name %>_usage() {
|
3
3
|
if [[ -n $long_usage ]]; then
|
4
4
|
<%- if summary == help -%>
|
5
|
-
|
5
|
+
printf "<%= caption_string %>\n"
|
6
6
|
echo
|
7
7
|
<%- else -%>
|
8
|
-
|
8
|
+
printf "<%= full_name %>\n"
|
9
9
|
echo
|
10
|
-
|
10
|
+
printf "<%= help.wrap(78).indent(2).sanitize_for_print %>\n"
|
11
11
|
echo
|
12
12
|
<%- end -%>
|
13
13
|
else
|
14
|
-
|
14
|
+
printf "<%= caption_string %>\n"
|
15
15
|
echo
|
16
16
|
fi
|
17
|
-
|
18
|
-
|
17
|
+
printf "<%= strings[:usage] %>\n"
|
18
|
+
printf " <%= usage_string %>\n"
|
19
19
|
<%- if commands.any? -%>
|
20
|
-
|
20
|
+
printf " <%= full_name %> [command] --help | -h\n"
|
21
21
|
<%- else -%>
|
22
|
-
|
22
|
+
printf " <%= full_name %> --help | -h\n"
|
23
23
|
<%- end -%>
|
24
24
|
<%- if root_command? -%>
|
25
|
-
|
25
|
+
printf " <%= full_name %> --version\n"
|
26
26
|
<%- end -%>
|
27
27
|
echo
|
28
28
|
<%= render(:usage_commands).indent 2 if commands.any? %>
|
29
29
|
|
30
30
|
if [[ -n $long_usage ]]; then
|
31
|
-
|
31
|
+
printf "<%= strings[:options] %>\n"
|
32
32
|
<%= render(:usage_fixed_flags).indent 4 %>
|
33
33
|
<%= render(:usage_flags).indent 4 if flags.any? %>
|
34
34
|
<%= render(:usage_args).indent 4 if args.any? %>
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# :command.usage_examples
|
2
|
-
|
2
|
+
printf "<%= strings[:examples] %>\n"
|
3
3
|
|
4
4
|
<%- examples.each do |example| -%>
|
5
|
-
|
5
|
+
printf "<%= example.wrap(78).indent(2).sanitize_for_print %>\n"
|
6
6
|
<%- end -%>
|
7
7
|
echo
|
@@ -1,9 +1,9 @@
|
|
1
1
|
# :command.usage_fixed_flags
|
2
2
|
echo " --help, -h"
|
3
|
-
|
3
|
+
printf " <%= strings[:help_flag_text] %>\n"
|
4
4
|
echo
|
5
5
|
<%- if root_command? -%>
|
6
6
|
echo " --version"
|
7
|
-
|
7
|
+
printf " <%= strings[:version_flag_text] %>\n"
|
8
8
|
echo
|
9
9
|
<%- end -%>
|
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.3.
|
4
|
+
version: 0.3.2
|
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: 2019-
|
11
|
+
date: 2019-12-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colsole
|