diff --git a/lib/bashly/views/command/initialize.gtx b/lib/bashly/views/command/initialize.gtx index 0b61fdec..fb019ef4 100644 --- a/lib/bashly/views/command/initialize.gtx +++ b/lib/bashly/views/command/initialize.gtx @@ -6,8 +6,8 @@ if root_command? > - = render(:variables).indent(2) = render(:environment_variables_default).indent 2 + = render(:variables).indent(2) end if user_file_exist?('initialize') diff --git a/spec/approvals/fixtures/var-order b/spec/approvals/fixtures/var-order new file mode 100644 index 00000000..4cebc48b --- /dev/null +++ b/spec/approvals/fixtures/var-order @@ -0,0 +1,11 @@ ++ bundle exec bashly generate +creating user files in src +skipped src/root_command.sh (exists) +created ./cli +run ./cli --help to test your bash script ++ ./cli +args: none + +environment variables: +- $CLI_CONFIG_FILE = config.yaml +$config_file == $CLI_CONFIG_FILE == config.yaml diff --git a/spec/fixtures/workspaces/var-order/.gitignore b/spec/fixtures/workspaces/var-order/.gitignore new file mode 100644 index 00000000..76ec9f59 --- /dev/null +++ b/spec/fixtures/workspaces/var-order/.gitignore @@ -0,0 +1 @@ +cli \ No newline at end of file diff --git a/spec/fixtures/workspaces/var-order/README.md b/spec/fixtures/workspaces/var-order/README.md new file mode 100644 index 00000000..e8a4b9b5 --- /dev/null +++ b/spec/fixtures/workspaces/var-order/README.md @@ -0,0 +1,3 @@ +This fixture ensures that environment variables are declared and populated +begore variables defined in bashly.yml, to allow using the values from them +in the variables. diff --git a/spec/fixtures/workspaces/var-order/src/bashly.yml b/spec/fixtures/workspaces/var-order/src/bashly.yml new file mode 100644 index 00000000..3ebdb274 --- /dev/null +++ b/spec/fixtures/workspaces/var-order/src/bashly.yml @@ -0,0 +1,12 @@ +name: cli +help: Ensure env var / var order +version: 0.1.0 + +environment_variables: +- name: cli_config_file + help: Path to config file + default: config.yaml + +variables: +- name: config_file + value: $CLI_CONFIG_FILE diff --git a/spec/fixtures/workspaces/var-order/src/root_command.sh b/spec/fixtures/workspaces/var-order/src/root_command.sh new file mode 100644 index 00000000..afadcf1c --- /dev/null +++ b/spec/fixtures/workspaces/var-order/src/root_command.sh @@ -0,0 +1,2 @@ +inspect_args +echo "\$config_file == \$CLI_CONFIG_FILE == $config_file" diff --git a/spec/fixtures/workspaces/var-order/test.sh b/spec/fixtures/workspaces/var-order/test.sh new file mode 100644 index 00000000..a56dc8d8 --- /dev/null +++ b/spec/fixtures/workspaces/var-order/test.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +set -x + +bundle exec bashly generate +./cli \ No newline at end of file