Module: Warg::Command::BehaviorWithoutRegistration
- Included in:
- Warg::Command
- Defined in:
- lib/warg.rb
Defined Under Namespace
Modules: ClassMethods
Instance Attribute Summary collapse
-
#argv ⇒ Object
readonly
Returns the value of attribute argv.
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#hosts ⇒ Object
readonly
Returns the value of attribute hosts.
-
#operations ⇒ Object
readonly
Returns the value of attribute operations.
-
#parser ⇒ Object
readonly
Returns the value of attribute parser.
-
#steps ⇒ Object
readonly
Returns the value of attribute steps.
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
- #chain(*others) ⇒ Object
- #command_name ⇒ Object
- #initialize(context) ⇒ Object
- #name ⇒ Object
- #on_failure(execution_result) ⇒ Object
- #run ⇒ Object
- #setup ⇒ Object
- #SGR(text) ⇒ Object
- #|(other) ⇒ Object
Instance Attribute Details
#argv ⇒ Object (readonly)
Returns the value of attribute argv.
1923 1924 1925 |
# File 'lib/warg.rb', line 1923 def argv @argv end |
#context ⇒ Object (readonly)
Returns the value of attribute context.
1924 1925 1926 |
# File 'lib/warg.rb', line 1924 def context @context end |
#hosts ⇒ Object (readonly)
Returns the value of attribute hosts.
1925 1926 1927 |
# File 'lib/warg.rb', line 1925 def hosts @hosts end |
#operations ⇒ Object (readonly)
Returns the value of attribute operations.
1926 1927 1928 |
# File 'lib/warg.rb', line 1926 def operations @operations end |
#parser ⇒ Object (readonly)
Returns the value of attribute parser.
1927 1928 1929 |
# File 'lib/warg.rb', line 1927 def parser @parser end |
#steps ⇒ Object (readonly)
Returns the value of attribute steps.
1928 1929 1930 |
# File 'lib/warg.rb', line 1928 def steps @steps end |
Class Method Details
.included(klass) ⇒ Object
1907 1908 1909 |
# File 'lib/warg.rb', line 1907 def self.included(klass) klass.extend(ClassMethods) end |
Instance Method Details
#call ⇒ Object
1947 1948 1949 1950 |
# File 'lib/warg.rb', line 1947 def call setup self end |
#chain(*others) ⇒ Object
1972 1973 1974 1975 1976 |
# File 'lib/warg.rb', line 1972 def chain(*others) others.inject(self) do |execution, command| execution | command end end |
#command_name ⇒ Object
1964 1965 1966 |
# File 'lib/warg.rb', line 1964 def command_name self.class.command_name end |
#initialize(context) ⇒ Object
1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 |
# File 'lib/warg.rb', line 1930 def initialize(context) @context = context @parser = @context.parser @hosts = @context.hosts @argv = @context.argv.dup configure_parser! @context.queue!(self) @steps = [] end |
#name ⇒ Object
1943 1944 1945 |
# File 'lib/warg.rb', line 1943 def name command_name.cli end |
#on_failure(execution_result) ⇒ Object
1978 1979 1980 |
# File 'lib/warg.rb', line 1978 def on_failure(execution_result) exit 1 end |
#run ⇒ Object
1955 1956 1957 1958 1959 1960 1961 1962 |
# File 'lib/warg.rb', line 1955 def run Warg.console.puts Console::SGR(command_name.console).with(text_color: :blue, effect: :bold) @steps.each do |deferred| Warg.console.puts Console::SGR(" -> #{deferred.}").with(text_color: :magenta) deferred.run end end |
#setup ⇒ Object
1952 1953 |
# File 'lib/warg.rb', line 1952 def setup end |
#SGR(text) ⇒ Object
1982 1983 1984 |
# File 'lib/warg.rb', line 1982 def SGR(text) Console::SGR(text) end |
#|(other) ⇒ Object
1968 1969 1970 |
# File 'lib/warg.rb', line 1968 def |(other) other.(context) end |