Class: Agent::Lock::CLI::Commands::Completion

Inherits:
Dry::CLI::Autocomplete::Command
  • Object
show all
Defined in:
lib/agent/lock/cli/commands/completion.rb

Overview

alock completion bash|zsh, from dry-cli-autocomplete, with the two things that gem's command cannot do for us restated here.

It writes to $stdout directly, which the in-process launcher can neither capture nor redirect, and it binds a registry by way of Class.new, which is exactly where dry-cli clears an inherited desc and example. Both belong upstream; until then, here.

Class Method Summary collapse

Class Method Details

.[](registry, program_name: nil) ⇒ Class

Binding a registry subclasses this command, and dry-cli's inherited hook starts every subclass with no description and no examples. Arguments and options survive it; those two do not, so they are copied across by hand.

Parameters:

  • registry (Dry::CLI::Registry)

Returns:

  • (Class)


34
35
36
37
38
39
# File 'lib/agent/lock/cli/commands/completion.rb', line 34

def self.[](registry, program_name: nil)
  super.tap do |bound|
    bound.desc(description)
    bound.example(*examples)
  end
end