Skip to content

Commit fd0fa1b

Browse files
committed
fix strict mode
1 parent e3178e3 commit fd0fa1b

File tree

7 files changed

+20
-6
lines changed

7 files changed

+20
-6
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
echo "# this file is located in 'src/admin_list_command.sh'"
2+
echo "# code for 'cli admin list' goes here"
3+
echo "# you can edit it freely and regenerate (it will not be overwritten)"
4+
inspect_args
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
echo "# this file is located in 'src/admin_reboot_command.sh'"
2+
echo "# code for 'cli admin reboot' goes here"
3+
echo "# you can edit it freely and regenerate (it will not be overwritten)"
4+
inspect_args

lib/bashly/script/introspection/visibility.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ module Bashly
22
module Script
33
module Introspection
44
module Visibility
5-
# Returns the true if the command is private and can be revealed using
6-
# an environment variable name
5+
# Returns :public, :private, or :semi_private based on the `private`
6+
# option of the host, in confunction with `Settings.private_reveal_key`.
77
def visibility
88
if !options['private']
99
:public

lib/bashly/views/command/usage_commands.gtx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ command_help_data.each do |group, commands|
1414
end
1515

1616
if info[:visibility] == :semi_private
17-
line = %Q[[[ -n "$#{Settings.private_reveal_key}" ]] && #{line}]
17+
line = %Q[[[ -n "${#{Settings.private_reveal_key}:-}" ]] && #{line}]
1818
end
1919

2020
= line

lib/bashly/views/command/usage_environment_variables.gtx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ if public_environment_variables.any?
55
= caption
66
>
77
elsif environment_variables.any? && Settings.private_reveal_key
8-
> if [[ -n "${{ Settings.private_reveal_key }}" ]]; then
8+
> if [[ -n "${{{ Settings.private_reveal_key }}:-}" ]]; then
99
= caption.indent(2)
1010
> fi
1111
>
@@ -15,7 +15,7 @@ environment_variables.each do |env_var|
1515
next if env_var.visibility == :private
1616

1717
if env_var.visibility == :semi_private
18-
> if [[ -n "${{ Settings.private_reveal_key }}" ]]; then
18+
> if [[ -n "${{{ Settings.private_reveal_key }}:-}" ]]; then
1919
= env_var.render(:usage).indent(2)
2020
> fi
2121
else

lib/bashly/views/command/usage_flags.gtx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ flags.each do |flag|
44
next if flag.visibility == :private
55

66
if flag.visibility == :semi_private
7-
> if [[ -n "${{ Settings.private_reveal_key }}" ]]; then
7+
> if [[ -n "${{{ Settings.private_reveal_key }}:-}" ]]; then
88
= flag.render(:usage).indent(2)
99
> fi
1010
else

spec/approvals/examples/private-reveal

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
+ bashly generate
2+
creating user files in src
3+
created src/admin_list_command.sh
4+
created src/admin_reboot_command.sh
5+
created ./cli
6+
run ./cli --help to test your bash script
17
+ ./cli
28
cli - Sample application
39

0 commit comments

Comments
 (0)