diff --git a/examples/colors/colorly b/examples/colors/colorly index dfbfe841..50756a2b 100644 --- a/examples/colors/colorly +++ b/examples/colors/colorly @@ -173,12 +173,7 @@ run() { declare -A args parse_requirements "$@" - if [[ ${args[--version]} ]]; then - version_command - elif [[ ${args[--help]} ]]; then - long_usage=yes - colorly_usage - elif [[ $action == "root" ]]; then + if [[ $action == "root" ]]; then root_command fi } diff --git a/examples/command-default/ftp b/examples/command-default/ftp index f18b0496..d3fff34d 100644 --- a/examples/command-default/ftp +++ b/examples/command-default/ftp @@ -363,11 +363,6 @@ run() { ftp_download_command fi - elif [[ ${args[--version]} ]]; then - version_command - elif [[ ${args[--help]} ]]; then - long_usage=yes - ftp_usage elif [[ $action == "root" ]]; then root_command fi diff --git a/examples/command-groups/ftp b/examples/command-groups/ftp index 44e54042..fc16079d 100644 --- a/examples/command-groups/ftp +++ b/examples/command-groups/ftp @@ -538,11 +538,6 @@ run() { ftp_logout_command fi - elif [[ ${args[--version]} ]]; then - version_command - elif [[ ${args[--help]} ]]; then - long_usage=yes - ftp_usage elif [[ $action == "root" ]]; then root_command fi diff --git a/examples/commands-nested/cli b/examples/commands-nested/cli index 169d3250..e13ec9bf 100644 --- a/examples/commands-nested/cli +++ b/examples/commands-nested/cli @@ -790,11 +790,6 @@ run() { cli_file_edit_command fi - elif [[ ${args[--version]} ]]; then - version_command - elif [[ ${args[--help]} ]]; then - long_usage=yes - cli_usage elif [[ $action == "root" ]]; then root_command fi diff --git a/examples/commands/cli b/examples/commands/cli index d9083dd8..9cdd464a 100644 --- a/examples/commands/cli +++ b/examples/commands/cli @@ -434,11 +434,6 @@ run() { cli_upload_command fi - elif [[ ${args[--version]} ]]; then - version_command - elif [[ ${args[--help]} ]]; then - long_usage=yes - cli_usage elif [[ $action == "root" ]]; then root_command fi diff --git a/examples/config-ini/configly b/examples/config-ini/configly index 4395206f..6443693f 100644 --- a/examples/config-ini/configly +++ b/examples/config-ini/configly @@ -620,11 +620,6 @@ run() { configly_list_command fi - elif [[ ${args[--version]} ]]; then - version_command - elif [[ ${args[--help]} ]]; then - long_usage=yes - configly_usage elif [[ $action == "root" ]]; then root_command fi diff --git a/examples/custom-includes/download b/examples/custom-includes/download index db2e75a4..5b03d72f 100644 --- a/examples/custom-includes/download +++ b/examples/custom-includes/download @@ -145,12 +145,7 @@ run() { declare -A args parse_requirements "$@" - if [[ ${args[--version]} ]]; then - version_command - elif [[ ${args[--help]} ]]; then - long_usage=yes - download_usage - elif [[ $action == "root" ]]; then + if [[ $action == "root" ]]; then root_command fi } diff --git a/examples/custom-strings/download b/examples/custom-strings/download index 631b2edb..536b96e4 100644 --- a/examples/custom-strings/download +++ b/examples/custom-strings/download @@ -161,12 +161,7 @@ run() { declare -A args parse_requirements "$@" - if [[ ${args[--version]} ]]; then - version_command - elif [[ ${args[--help]} ]]; then - long_usage=yes - download_usage - elif [[ $action == "root" ]]; then + if [[ $action == "root" ]]; then root_command fi } diff --git a/examples/default-values/convert b/examples/default-values/convert index 12695f36..b8a10011 100644 --- a/examples/default-values/convert +++ b/examples/default-values/convert @@ -161,12 +161,7 @@ run() { declare -A args parse_requirements "$@" - if [[ ${args[--version]} ]]; then - version_command - elif [[ ${args[--help]} ]]; then - long_usage=yes - convert_usage - elif [[ $action == "root" ]]; then + if [[ $action == "root" ]]; then root_command fi } diff --git a/examples/dependencies/cli b/examples/dependencies/cli index 501c07ce..07e887ab 100644 --- a/examples/dependencies/cli +++ b/examples/dependencies/cli @@ -319,11 +319,6 @@ run() { cli_upload_command fi - elif [[ ${args[--version]} ]]; then - version_command - elif [[ ${args[--help]} ]]; then - long_usage=yes - cli_usage elif [[ $action == "root" ]]; then root_command fi diff --git a/examples/docker-like/docker b/examples/docker-like/docker index e9d4ffab..4572f4f2 100644 --- a/examples/docker-like/docker +++ b/examples/docker-like/docker @@ -650,11 +650,6 @@ run() { docker_image_ls_command fi - elif [[ ${args[--version]} ]]; then - version_command - elif [[ ${args[--help]} ]]; then - long_usage=yes - docker_usage elif [[ $action == "root" ]]; then root_command fi diff --git a/examples/environment-variables/cli b/examples/environment-variables/cli index e7b73b6e..497241c2 100644 --- a/examples/environment-variables/cli +++ b/examples/environment-variables/cli @@ -244,11 +244,6 @@ run() { cli_verify_command fi - elif [[ ${args[--version]} ]]; then - version_command - elif [[ ${args[--help]} ]]; then - long_usage=yes - cli_usage elif [[ $action == "root" ]]; then root_command fi diff --git a/examples/git-like/git b/examples/git-like/git index ec320956..86a1e4c8 100644 --- a/examples/git-like/git +++ b/examples/git-like/git @@ -345,11 +345,6 @@ run() { git_commit_command fi - elif [[ ${args[--version]} ]]; then - version_command - elif [[ ${args[--help]} ]]; then - long_usage=yes - git_usage elif [[ $action == "root" ]]; then root_command fi diff --git a/examples/minimal/download b/examples/minimal/download index ea62cb44..42fd7abd 100644 --- a/examples/minimal/download +++ b/examples/minimal/download @@ -165,12 +165,7 @@ run() { declare -A args parse_requirements "$@" - if [[ ${args[--version]} ]]; then - version_command - elif [[ ${args[--help]} ]]; then - long_usage=yes - download_usage - elif [[ $action == "root" ]]; then + if [[ $action == "root" ]]; then root_command fi } diff --git a/examples/minus-v/cli b/examples/minus-v/cli index d8931030..8d7d6cfd 100644 --- a/examples/minus-v/cli +++ b/examples/minus-v/cli @@ -148,12 +148,7 @@ run() { declare -A args parse_requirements "$@" - if [[ ${args[--version]} ]]; then - version_command - elif [[ ${args[--help]} ]]; then - long_usage=yes - cli_usage - elif [[ $action == "root" ]]; then + if [[ $action == "root" ]]; then root_command fi } diff --git a/examples/multiline/multi b/examples/multiline/multi index fd646a80..c509c196 100644 --- a/examples/multiline/multi +++ b/examples/multiline/multi @@ -364,11 +364,6 @@ run() { multi_regular_command fi - elif [[ ${args[--version]} ]]; then - version_command - elif [[ ${args[--help]} ]]; then - long_usage=yes - multi_usage elif [[ $action == "root" ]]; then root_command fi diff --git a/examples/yaml/yaml b/examples/yaml/yaml index 3fdfb696..55bf9ae6 100644 --- a/examples/yaml/yaml +++ b/examples/yaml/yaml @@ -225,12 +225,7 @@ run() { declare -A args parse_requirements "$@" - if [[ ${args[--version]} ]]; then - version_command - elif [[ ${args[--help]} ]]; then - long_usage=yes - yaml_usage - elif [[ $action == "root" ]]; then + if [[ $action == "root" ]]; then root_command fi } diff --git a/lib/bashly/views/command/run.erb b/lib/bashly/views/command/run.erb index 40d62e51..e2251cbc 100644 --- a/lib/bashly/views/command/run.erb +++ b/lib/bashly/views/command/run.erb @@ -14,12 +14,7 @@ run() { fi <% condition = "elif" %> <%- end -%> - <%= condition %> [[ ${args[--version]} ]]; then - version_command - elif [[ ${args[--help]} ]]; then - long_usage=yes - <%= name %>_usage - elif [[ $action == "root" ]]; then + <%= condition %> [[ $action == "root" ]]; then root_command fi } \ No newline at end of file diff --git a/spec/fixtures/workspaces/flag-args-with-dash/argflag b/spec/fixtures/workspaces/flag-args-with-dash/argflag index 7a963e03..a458183b 100644 --- a/spec/fixtures/workspaces/flag-args-with-dash/argflag +++ b/spec/fixtures/workspaces/flag-args-with-dash/argflag @@ -148,12 +148,7 @@ run() { declare -A args parse_requirements "$@" - if [[ ${args[--version]} ]]; then - version_command - elif [[ ${args[--help]} ]]; then - long_usage=yes - argflag_usage - elif [[ $action == "root" ]]; then + if [[ $action == "root" ]]; then root_command fi }