Skip to content

Commit

Permalink
Use filter_map instead of collect...compact
Browse files Browse the repository at this point in the history
  • Loading branch information
sferik committed May 1, 2023
1 parent 52a873a commit 47bccee
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tasks/bash.rake
Expand Up @@ -54,13 +54,13 @@ module BashCompletion
options_str = options(cmd).join(" ")
subcmds = subcommands(cmd)

opts_args = cmd.options.collect do |_, opt|
opts_args = cmd.options.filter_map do |_, opt|
cases = opt.enum
if cases
%[#{option_str(opt).tr(' ', '|')})
completions='#{cases.join(' ')}' ;;]
end
end.compact
end

if subcmds.empty?
%[#{cmd.name})
Expand Down

0 comments on commit 47bccee

Please sign in to comment.