Class: Bridgetown::Command

Inherits:
Samovar::Command
  • Object
show all
Defined in:
bridgetown-core/lib/bridgetown-core/command.rb

Class Method Summary collapse

Class Method Details

.command_line(name) ⇒ Object

Samovar shows all command options by default when printing out a command name string. We want to hide that part of the output, as options are already listed out separately



85
86
87
88
89
90
91
92
93
94
95
# File 'bridgetown-core/lib/bridgetown-core/command.rb', line 85

def self.command_line(name)
  table = self.table.merged

  usage_string = table.each.collect do |row|
    next "" if row.is_a?(Samovar::Options)

    row.to_s
  end.reject(&:empty?).join(" ")

  "#{name} #{usage_string}"
end

.start(args = []) ⇒ Object

Compatibility syntax to execute commands. It’s recommended you use Samovar’s more idiomatic CmdClass[*args].call syntax instead



81
# File 'bridgetown-core/lib/bridgetown-core/command.rb', line 81

def self.start(args = []) = self[*args].call

.summaryObject



77
# File 'bridgetown-core/lib/bridgetown-core/command.rb', line 77

def self.summary = description