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.



1882
1883
1884
# File 'lib/warg.rb', line 1882

def argv
  @argv
end

#contextObject (readonly)

Returns the value of attribute context.



1883
1884
1885
# File 'lib/warg.rb', line 1883

def context
  @context
end

#hostsObject (readonly)

Returns the value of attribute hosts.



1884
1885
1886
# File 'lib/warg.rb', line 1884

def hosts
  @hosts
end

#parserObject (readonly)

Returns the value of attribute parser.



1885
1886
1887
# File 'lib/warg.rb', line 1885

def parser
  @parser
end

#playlistObject (readonly)

Returns the value of attribute playlist.



1886
1887
1888
# File 'lib/warg.rb', line 1886

def playlist
  @playlist
end

Class Method Details

.included(klass) ⇒ Object



1866
1867
1868
# File 'lib/warg.rb', line 1866

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

Instance Method Details

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



1933
1934
1935
# File 'lib/warg.rb', line 1933

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

#callObject



1903
1904
1905
1906
# File 'lib/warg.rb', line 1903

def call
  run
  self
end

#chain(*others) ⇒ Object



1919
1920
1921
1922
1923
# File 'lib/warg.rb', line 1919

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

#command_nameObject



1911
1912
1913
# File 'lib/warg.rb', line 1911

def command_name
  self.class.command_name
end

#initialize(context) ⇒ Object



1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
# File 'lib/warg.rb', line 1888

def initialize(context)
  @context = context

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

  configure_parser!
end

#nameObject



1899
1900
1901
# File 'lib/warg.rb', line 1899

def name
  command_name.cli
end

#on_failure(execution_result) ⇒ Object



1925
1926
1927
# File 'lib/warg.rb', line 1925

def on_failure(execution_result)
  exit 1
end

#runObject



1908
1909
# File 'lib/warg.rb', line 1908

def run
end

#SGR(text) ⇒ Object



1929
1930
1931
# File 'lib/warg.rb', line 1929

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

#|(other) ⇒ Object



1915
1916
1917
# File 'lib/warg.rb', line 1915

def |(other)
  other.(context)
end