Skip to content

Commit 567d194

Browse files
committed
- Automatically add allowed arguments to completions
1 parent 8aa0275 commit 567d194

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/bashly/concerns/completions.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,21 @@ def completion_flag_names
3131
flags.map(&:name) + flags.map(&:short)
3232
end
3333

34+
def completion_flag_whitelist
35+
flags.map(&:allowed).flatten
36+
end
37+
3438
def completion_words(with_version: false)
3539
trivial_flags = %w[--help -h]
3640
trivial_flags += %w[--version -v] if with_version
3741
all = (
3842
command_names + trivial_flags +
39-
completion_flag_names
43+
completion_flag_names +
44+
completion_flag_whitelist
4045
)
4146

4247
all += completions if completions
48+
all += allowed if allowed
4349
all.compact.uniq.sort
4450
end
4551

0 commit comments

Comments
 (0)