Class: GLI::Command

Inherits:
Object
  • Object
show all
Includes:
Cartage::CLIOptionsSupport
Defined in:
lib/cartage/gli_ext.rb

Overview

:nodoc:

Instance Method Summary collapse

Methods included from Cartage::CLIOptionsSupport

#clear_defaults_from

Instance Method Details

#appObject

Indicate the parent GLI application.



50
51
52
# File 'lib/cartage/gli_ext.rb', line 50

def app
  parent.app
end

#hide!Object

Mark the provided command as hidden from documentation.



55
56
57
# File 'lib/cartage/gli_ext.rb', line 55

def hide!
  singleton_class.send(:define_method, :nodoc) { true }
end

#plugin_version_command(*plugin_classes) ⇒ Object



59
60
61
62
63
64
65
66
67
68
69
# File 'lib/cartage/gli_ext.rb', line 59

def plugin_version_command(*plugin_classes)
  desc 'Show the plug-in version'
  command 'version' do |version|
    version.hide!
    version.action do |_g, _o, _a|
      plugin_classes.each do |plugin_class|
        puts "cartage-#{plugin_class.plugin_name}: #{plugin_class.version}"
      end
    end
  end
end