Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions examples/config-ini/configly
Original file line number Diff line number Diff line change
Expand Up @@ -272,15 +272,15 @@ config_show() {
# :command.command_functions
# :command.function
configly_set_command() {
# :src/configly_set_command.sh
# :src/set_command.sh
# Using the standard library (lib/config.sh) to store a value to the config
config_set "${args[key]}" "${args[value]}"
echo "saved: ${args[key]} = ${args[value]}"
}

# :command.function
configly_get_command() {
# :src/configly_get_command.sh
# :src/get_command.sh
# Using the standard library (lib/config.sh) to show a value from the config
config_get "${args[key]}"

Expand All @@ -291,7 +291,7 @@ configly_get_command() {

# :command.function
configly_list_command() {
# :src/configly_list_command.sh
# :src/list_command.sh
# Using the standard library (lib/config.sh) to show the entire config file
config_show
}
Expand Down
8 changes: 4 additions & 4 deletions examples/multiline/multi
Original file line number Diff line number Diff line change
Expand Up @@ -146,17 +146,17 @@ inspect_args() {
# :command.command_functions
# :command.function
multi_multiline_command() {
# :src/multi_multiline_command.sh
echo "# this file is located in 'src/multi_multiline_command.sh'"
# :src/multiline_command.sh
echo "# this file is located in 'src/multiline_command.sh'"
echo "# code for 'multi multiline' goes here"
echo "# you can edit it freely and regenerate (it will not be overwritten)"
inspect_args
}

# :command.function
multi_regular_command() {
# :src/multi_regular_command.sh
echo "# this file is located in 'src/multi_regular_command.sh'"
# :src/regular_command.sh
echo "# this file is located in 'src/regular_command.sh'"
echo "# code for 'multi regular' goes here"
echo "# you can edit it freely and regenerate (it will not be overwritten)"
inspect_args
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
echo "# this file is located in 'src/multi_multiline_command.sh'"
echo "# this file is located in 'src/multiline_command.sh'"
echo "# code for 'multi multiline' goes here"
echo "# you can edit it freely and regenerate (it will not be overwritten)"
inspect_args
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
echo "# this file is located in 'src/multi_regular_command.sh'"
echo "# this file is located in 'src/regular_command.sh'"
echo "# code for 'multi regular' goes here"
echo "# you can edit it freely and regenerate (it will not be overwritten)"
inspect_args
8 changes: 4 additions & 4 deletions examples/subcommands/cli
Original file line number Diff line number Diff line change
Expand Up @@ -161,17 +161,17 @@ inspect_args() {
# :command.command_functions
# :command.function
cli_download_command() {
# :src/cli_download_command.sh
echo "# this file is located in 'src/cli_download_command.sh'"
# :src/download_command.sh
echo "# this file is located in 'src/download_command.sh'"
echo "# code for 'cli download' goes here"
echo "# you can edit it freely and regenerate (it will not be overwritten)"
inspect_args
}

# :command.function
cli_upload_command() {
# :src/cli_upload_command.sh
echo "# this file is located in 'src/cli_upload_command.sh'"
# :src/upload_command.sh
echo "# this file is located in 'src/upload_command.sh'"
echo "# code for 'cli upload' goes here"
echo "# you can edit it freely and regenerate (it will not be overwritten)"
inspect_args
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
echo "# this file is located in 'src/cli_download_command.sh'"
echo "# this file is located in 'src/download_command.sh'"
echo "# code for 'cli download' goes here"
echo "# you can edit it freely and regenerate (it will not be overwritten)"
inspect_args
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
echo "# this file is located in 'src/cli_upload_command.sh'"
echo "# this file is located in 'src/upload_command.sh'"
echo "# code for 'cli upload' goes here"
echo "# you can edit it freely and regenerate (it will not be overwritten)"
inspect_args
2 changes: 1 addition & 1 deletion lib/bashly/commands/generate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def create_root_command_file

def create_all_command_files
command.commands.each do |subcommand|
file = "#{Settings.source_dir}/#{subcommand.full_name.to_underscore}_command.sh"
file = "#{Settings.source_dir}/#{subcommand.name.to_underscore}_command.sh"
content = subcommand.render :default_script
create_file file, content
end
Expand Down
3 changes: 1 addition & 2 deletions lib/bashly/templates/lib/config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ config_show() {
# done
#
config_keys() {
key=$1
regex="^(.*)\s*="

config_init
Expand All @@ -112,5 +111,5 @@ config_keys() {
keys+=("$key")
fi
done < "$CONFIG_FILE"
echo ${keys[@]}
echo "${keys[@]}"
}
2 changes: 1 addition & 1 deletion lib/bashly/views/command/default_script.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
echo "# this file is located in '<%= Settings.source_dir %>/<%= full_name.to_underscore %>_command.sh'"
echo "# this file is located in '<%= Settings.source_dir %>/<%= name.to_underscore %>_command.sh'"
echo "# code for '<%= full_name %>' goes here"
echo "# you can edit it freely and regenerate (it will not be overwritten)"
inspect_args
2 changes: 1 addition & 1 deletion lib/bashly/views/command/function.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# :command.function
<%= full_name.to_underscore %>_command() {
<%= load_user_file("#{full_name.to_underscore}_command.sh").indent 2 %>
<%= load_user_file("#{name.to_underscore}_command.sh").indent 2 %>
}
4 changes: 2 additions & 2 deletions spec/approvals/cli/generate/no-args
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
creating user files in spec/tmp/src
created spec/tmp/src/initialize.sh
created spec/tmp/src/cli_download_command.sh
created spec/tmp/src/cli_upload_command.sh
created spec/tmp/src/download_command.sh
created spec/tmp/src/upload_command.sh
created spec/tmp/cli
run spec/tmp/cli --help to test your bash script
4 changes: 2 additions & 2 deletions spec/approvals/cli/generate/no-args-skip
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
creating user files in spec/tmp/src
skipped spec/tmp/src/initialize.sh (exists)
skipped spec/tmp/src/cli_download_command.sh (exists)
skipped spec/tmp/src/cli_upload_command.sh (exists)
skipped spec/tmp/src/download_command.sh (exists)
skipped spec/tmp/src/upload_command.sh (exists)
created spec/tmp/cli
run spec/tmp/cli --help to test your bash script
6 changes: 3 additions & 3 deletions spec/approvals/examples/config-ini
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
+ bashly generate
creating user files in src
skipped src/initialize.sh (exists)
skipped src/configly_set_command.sh (exists)
skipped src/configly_get_command.sh (exists)
skipped src/configly_list_command.sh (exists)
skipped src/set_command.sh (exists)
skipped src/get_command.sh (exists)
skipped src/list_command.sh (exists)
created ./configly
run ./configly --help to test your bash script
+ ./configly -h
Expand Down
6 changes: 3 additions & 3 deletions spec/approvals/examples/multiline
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
+ bashly generate
creating user files in src
created src/initialize.sh
created src/multi_multiline_command.sh
created src/multi_regular_command.sh
created src/multiline_command.sh
created src/regular_command.sh
created ./multi
run ./multi --help to test your bash script
+ ./multi
Expand Down Expand Up @@ -50,7 +50,7 @@ Examples:
multi multiline --flag

+ ./multi multiline
# this file is located in 'src/multi_multiline_command.sh'
# this file is located in 'src/multiline_command.sh'
# code for 'multi multiline' goes here
# you can edit it freely and regenerate (it will not be overwritten)
args:
Expand Down
6 changes: 3 additions & 3 deletions spec/approvals/examples/short-flag
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
+ bashly generate
creating user files in src
created src/initialize.sh
created src/rush_config_command.sh
created src/rush_get_command.sh
created src/config_command.sh
created src/get_command.sh
created ./rush
run ./rush --help to test your bash script
+ ./rush c
# this file is located in 'src/rush_config_command.sh'
# this file is located in 'src/config_command.sh'
# code for 'rush config' goes here
# you can edit it freely and regenerate (it will not be overwritten)
args:
Expand Down
8 changes: 4 additions & 4 deletions spec/approvals/examples/subcommands
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
+ bashly generate
creating user files in src
created src/initialize.sh
created src/cli_download_command.sh
created src/cli_upload_command.sh
created src/download_command.sh
created src/upload_command.sh
created ./cli
run ./cli --help to test your bash script
+ ./cli
Expand Down Expand Up @@ -73,7 +73,7 @@ Examples:
missing required argument: SOURCE
usage: cli download SOURCE [TARGET] [options]
+ ./cli download sourcefile targetfile -f
# this file is located in 'src/cli_download_command.sh'
# this file is located in 'src/download_command.sh'
# code for 'cli download' goes here
# you can edit it freely and regenerate (it will not be overwritten)
args:
Expand Down Expand Up @@ -106,7 +106,7 @@ Arguments:
+ ./cli upload sourcefile
missing required flag: --user, -u USER
+ ./cli upload sourcefile -u username
# this file is located in 'src/cli_upload_command.sh'
# this file is located in 'src/upload_command.sh'
# code for 'cli upload' goes here
# you can edit it freely and regenerate (it will not be overwritten)
args:
Expand Down