Sha256: 25c6fc007a19b54f6fdb22229a30b775e181e0c2a813cdff754364ec6343d6d6

Contents?: true

Size: 981 Bytes

Versions: 17

Compression:

Stored size: 981 Bytes

Contents

# Patch GLI's help formatters so they don't show subcommands that are
# supposed to be hidden.
module CommandHelpFormatPatch
  def format
    @command.commands.reject! {|k,c| c.nodoc}
    @command.commands_declaration_order.reject! {|c| c.nodoc}

    super
  end
end

module HelpCompletionFormatPatch
  def format
    name = @args.shift
    
    base = @command_finder.find_command(name)
    base = @command_finder.last_found_command if base.nil?
    base = @app if base.nil?
    
    prefix_to_match = @command_finder.last_unknown_command
    
    base.commands.reject {|_,c| c.nodoc}.values.map { |command|
      [command.name,command.aliases]
    }.flatten.compact.map(&:to_s).sort.select { |command_name|
      prefix_to_match.nil? || command_name =~ /^#{prefix_to_match}/
    }.join("\n")
  end
end

GLI::Commands::HelpModules::CommandHelpFormat.send(:prepend, CommandHelpFormatPatch)
GLI::Commands::HelpModules::HelpCompletionFormat.send(:prepend, HelpCompletionFormatPatch)

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
conjur-cli-6.2.6 lib/patches/gli.rb
conjur-cli-6.2.5 lib/patches/gli.rb
conjur-cli-6.2.4 lib/patches/gli.rb
conjur-cli-6.2.3 lib/patches/gli.rb
conjur-cli-6.2.2 lib/patches/gli.rb
conjur-cli-6.2.1 lib/patches/gli.rb
conjur-cli-6.2.0 lib/patches/gli.rb
conjur-cli-5.6.6 lib/patches/gli.rb
conjur-cli-6.1.0 lib/patches/gli.rb
conjur-cli-6.0.1 lib/patches/gli.rb
conjur-cli-5.6.5 lib/patches/gli.rb
conjur-cli-5.6.4 lib/patches/gli.rb
conjur-cli-5.6.3 lib/patches/gli.rb
conjur-cli-6.0.0 lib/patches/gli.rb
conjur-cli-6.0.0.rc1 lib/patches/gli.rb
conjur-cli-5.5.0 lib/patches/gli.rb
conjur-cli-5.4.0 lib/patches/gli.rb