Skip to content

Commit 3002a61

Browse files
committed
- Fix completions library to not show private commands
1 parent 9048c9b commit 3002a61

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

lib/bashly/concerns/completions.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def completion_data(with_version: true)
2929
end
3030
end
3131

32-
commands.each do |command|
32+
public_commands.each do |command|
3333
result.merge! command.completion_data(with_version: false)
3434
end
3535

@@ -73,7 +73,7 @@ def completion_words(with_version: false)
7373
trivial_flags = %w[--help -h]
7474
trivial_flags += %w[--version -v] if with_version
7575
all = (
76-
command_aliases + trivial_flags +
76+
public_command_aliases + trivial_flags +
7777
completion_flag_names + completion_allowed_args
7878
)
7979

lib/bashly/script/command.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,11 @@ def public_commands
223223
commands.reject(&:private)
224224
end
225225

226+
# Returns a full list of the public Command names and aliases combined
227+
def public_command_aliases
228+
public_commands.map(&:aliases).flatten
229+
end
230+
226231
# Returns only environment variables that are not private
227232
def public_environment_variables
228233
environment_variables.reject(&:private)

0 commit comments

Comments
 (0)