Skip to content

Commit da6a0f0

Browse files
committed
refactor thanks to code climate
1 parent 611d93f commit da6a0f0

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

lib/bashly/concerns/completions.rb

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,14 @@ module Bashly
66
module Completions
77
module Flag
88
def completion_data(command_full_name)
9-
result = {}
109
comps = allowed || completions
10+
return {} unless comps
1111

12-
if comps
13-
aliases.each do |name|
14-
prefix = command_full_name
15-
prefix = "#{prefix}*" unless prefix.end_with? '*'
16-
result["#{prefix}#{name}"] = comps
17-
end
12+
aliases.to_h do |name|
13+
prefix = command_full_name
14+
prefix = "#{prefix}*" unless prefix.end_with? '*'
15+
["#{prefix}#{name}", comps]
1816
end
19-
20-
result
2117
end
2218
end
2319

0 commit comments

Comments
 (0)