Module: Warg::Command::BehaviorWithoutRegistration

Included in:
Warg::Command
Defined in:
lib/warg.rb

Defined Under Namespace

Modules: ClassMethods

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#argvObject (readonly)

Returns the value of attribute argv.



1792
1793
1794
# File 'lib/warg.rb', line 1792

def argv
  @argv
end

#contextObject (readonly)

Returns the value of attribute context.



1793
1794
1795
# File 'lib/warg.rb', line 1793

def context
  @context
end

#hostsObject (readonly)

Returns the value of attribute hosts.



1794
1795
1796
# File 'lib/warg.rb', line 1794

def hosts
  @hosts
end

#parserObject (readonly)

Returns the value of attribute parser.



1795
1796
1797
# File 'lib/warg.rb', line 1795

def parser
  @parser
end

#playlistObject (readonly)

Returns the value of attribute playlist.



1796
1797
1798
# File 'lib/warg.rb', line 1796

def playlist
  @playlist
end

Class Method Details

.included(klass) ⇒ Object



1776
1777
1778
# File 'lib/warg.rb', line 1776

def self.included(klass)
  klass.extend(ClassMethods)
end

Instance Method Details

#and_then(order: :parallel, &block) ⇒ Object



1843
1844
1845
# File 'lib/warg.rb', line 1843

def and_then(order: :parallel, &block)
  @playlist.queue Step.callback(self, @playlist.insert_at, order, block)
end

#callObject



1813
1814
1815
1816
# File 'lib/warg.rb', line 1813

def call
  run
  self
end

#chain(*others) ⇒ Object



1829
1830
1831
1832
1833
# File 'lib/warg.rb', line 1829

def chain(*others)
  others.inject(self) do |execution, command|
    execution | command
  end
end

#command_nameObject



1821
1822
1823
# File 'lib/warg.rb', line 1821

def command_name
  self.class.command_name
end

#initialize(context) ⇒ Object



1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
# File 'lib/warg.rb', line 1798

def initialize(context)
  @context = context

  @parser = @context.parser
  @hosts = @context.hosts
  @argv = @context.argv.dup
  @playlist = @context.playlist

  configure_parser!
end

#nameObject



1809
1810
1811
# File 'lib/warg.rb', line 1809

def name
  command_name.cli
end

#on_failure(execution_result) ⇒ Object



1835
1836
1837
# File 'lib/warg.rb', line 1835

def on_failure(execution_result)
  exit 1
end

#runObject



1818
1819
# File 'lib/warg.rb', line 1818

def run
end

#SGR(text) ⇒ Object



1839
1840
1841
# File 'lib/warg.rb', line 1839

def SGR(text)
  Console::SGR(text)
end

#|(other) ⇒ Object



1825
1826
1827
# File 'lib/warg.rb', line 1825

def |(other)
  other.(context)
end