Exception: VerboseShell::ShellError
- Inherits:
-
RuntimeError
- Object
- RuntimeError
- VerboseShell::ShellError
- Defined in:
- lib/verbose-shell.rb
Instance Attribute Summary collapse
-
#cmd ⇒ Object
Returns the value of attribute cmd.
-
#exit_code ⇒ Object
Returns the value of attribute exit_code.
-
#output ⇒ Object
Returns the value of attribute output.
Instance Method Summary collapse
-
#initialize(output, cmd, exit_code) ⇒ ShellError
constructor
A new instance of ShellError.
- #message ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(output, cmd, exit_code) ⇒ ShellError
Returns a new instance of ShellError.
10 11 12 13 14 |
# File 'lib/verbose-shell.rb', line 10 def initialize(output, cmd, exit_code) @output = output @cmd = cmd @exit_code = exit_code end |
Instance Attribute Details
#cmd ⇒ Object
Returns the value of attribute cmd.
9 10 11 |
# File 'lib/verbose-shell.rb', line 9 def cmd @cmd end |
#exit_code ⇒ Object
Returns the value of attribute exit_code.
9 10 11 |
# File 'lib/verbose-shell.rb', line 9 def exit_code @exit_code end |
#output ⇒ Object
Returns the value of attribute output.
9 10 11 |
# File 'lib/verbose-shell.rb', line 9 def output @output end |
Instance Method Details
#message ⇒ Object
16 17 18 |
# File 'lib/verbose-shell.rb', line 16 def "\n\n"+(['']*20+@output.split("\n"))[-20..-1].join("\n").lstrip + "\n"+Pastel.new.bright_white.on_red("💩 Command \"#{@cmd[0]}\" returned #{@exit_code}") end |
#to_s ⇒ Object
19 |
# File 'lib/verbose-shell.rb', line 19 def to_s; ; end |