Skip to content

Commit 531d4d4

Browse files
committed
add specs for COMPLETELY_CONFIG_PATH
1 parent 8ef65e1 commit 531d4d4

File tree

14 files changed

+78
-4
lines changed

14 files changed

+78
-4
lines changed

lib/completely/commands/base.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,17 @@ class Base < MisterBin::Command
66

77
class << self
88
def param_config_path
9-
param "CONFIG_PATH", "Path to the YAML configuration file [default: completely.yaml]"
9+
param "CONFIG_PATH", "Path to the YAML configuration file [default: completely.yaml]\nCan also be set by an environment variable"
1010
end
1111

1212
def option_function
1313
option "-f --function NAME", "Modify the name of the function in the generated script"
1414
end
1515

16+
def environment_config_path
17+
environment "COMPLETELY_CONFIG_PATH", "Path to a completely configuration file [default: completely.yaml]"
18+
end
19+
1620
def environment_debug
1721
environment "COMPLETELY_DEBUG", "It not empty, the generated script will include an additional debugging snippet that outputs the compline and current word to a text file when a completion is requested"
1822
end

lib/completely/commands/generate.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ class Generate < Base
1313

1414
param_config_path
1515
param "OUTPUT_PATH", "Path to the output bash script. When not provided, the name of the input file will be used with a .bash extension"
16+
17+
environment_config_path
1618
environment_debug
1719

1820
def run

lib/completely/commands/init.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ class Init < Base
99
usage "completely init (-h|--help)"
1010

1111
param_config_path
12+
environment_config_path
1213

1314
def run
1415
if File.exist? config_path

lib/completely/commands/preview.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ class Preview < Base
1010

1111
option_function
1212
param_config_path
13+
environment_config_path
1314
environment_debug
1415

1516
def run

lib/completely/commands/test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class Test < Base
1818

1919
param "COMPLINE", "The command to test completions for. This will be handled as if a TAB was pressed immediately at the end of it, so the last word is considered the active cursor. If you wish to complete for the next word instead, end your command with a space."
2020

21-
environment "COMPLETELY_CONFIG_PATH", "Path to a completely configuration file [default: completely.yaml]"
21+
environment_config_path
2222
environment "COMPLETELY_SCRIPT_PATH", "Path to a completions script. When set, this script will be tested instead of the completely configuration file"
2323
environment "COMPLETELY_SCRIPT_FUNCTION", "The main completion function to call when using a custom script. If not set, the basename of the script path will be used, prefixed by an underscore"
2424
environment_debug
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Saved hello.bash

spec/approvals/cli/generate/help

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,16 @@ Options:
1818
Parameters:
1919
CONFIG_PATH
2020
Path to the YAML configuration file [default: completely.yaml]
21+
Can also be set by an environment variable
2122

2223
OUTPUT_PATH
2324
Path to the output bash script. When not provided, the name of the input
2425
file will be used with a .bash extension
2526

2627
Environment Variables:
28+
COMPLETELY_CONFIG_PATH
29+
Path to a completely configuration file [default: completely.yaml]
30+
2731
COMPLETELY_DEBUG
2832
It not empty, the generated script will include an additional debugging
2933
snippet that outputs the compline and current word to a text file when a
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Saved spec/tmp/hello.yml

spec/approvals/cli/init/help

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,8 @@ Options:
1111
Parameters:
1212
CONFIG_PATH
1313
Path to the YAML configuration file [default: completely.yaml]
14+
Can also be set by an environment variable
15+
16+
Environment Variables:
17+
COMPLETELY_CONFIG_PATH
18+
Path to a completely configuration file [default: completely.yaml]

spec/approvals/cli/preview/help

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,12 @@ Options:
1414
Parameters:
1515
CONFIG_PATH
1616
Path to the YAML configuration file [default: completely.yaml]
17+
Can also be set by an environment variable
1718

1819
Environment Variables:
20+
COMPLETELY_CONFIG_PATH
21+
Path to a completely configuration file [default: completely.yaml]
22+
1923
COMPLETELY_DEBUG
2024
It not empty, the generated script will include an additional debugging
2125
snippet that outputs the compline and current word to a text file when a

0 commit comments

Comments
 (0)