Class: Rubyists::Opr::Command
- Inherits:
-
Object
- Object
- Rubyists::Opr::Command
- Extended by:
- Forwardable
- Defined in:
- lib/rubyists::opr/command.rb
Overview
Command class
Direct Known Subclasses
Rubyists::Opr::Commands::Gen, Rubyists::Opr::Commands::Get, Rubyists::Opr::Commands::List::Items, Rubyists::Opr::Commands::List::Vaults, Rubyists::Opr::Commands::Rm
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#command(**options) ⇒ Object
The external commands runner.
-
#cursor ⇒ Object
The cursor movement.
-
#editor ⇒ Object
Open a file or text in the user’s preferred editor.
-
#exec_exist?(*args) ⇒ Boolean
Check if executable exists.
-
#execute ⇒ Object
Execute this command.
-
#generator ⇒ Object
File manipulation utility methods.
-
#pager(**options) ⇒ Object
Terminal output paging.
-
#platform ⇒ Object
Terminal platform and OS properties.
-
#prompt(**options) ⇒ Object
The interactive prompt.
-
#screen ⇒ Object
Get terminal screen properties.
-
#which(*args) ⇒ Object
The unix which utility.
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
13 14 15 |
# File 'lib/rubyists::opr/command.rb', line 13 def @options end |
Instance Method Details
#command(**options) ⇒ Object
The external commands runner
30 31 32 33 |
# File 'lib/rubyists::opr/command.rb', line 30 def command(**) require 'tty-command' TTY::Command.new() end |
#cursor ⇒ Object
The cursor movement
40 41 42 43 |
# File 'lib/rubyists::opr/command.rb', line 40 def cursor require 'tty-cursor' TTY::Cursor end |
#editor ⇒ Object
Open a file or text in the user’s preferred editor
50 51 52 53 |
# File 'lib/rubyists::opr/command.rb', line 50 def editor require 'tty-editor' TTY::Editor end |
#exec_exist?(*args) ⇒ Boolean
Check if executable exists
120 121 122 123 |
# File 'lib/rubyists::opr/command.rb', line 120 def exec_exist?(*args) require 'tty-which' TTY::Which.exist?(*args) end |
#execute ⇒ Object
Execute this command
18 19 20 21 22 23 |
# File 'lib/rubyists::opr/command.rb', line 18 def execute(*) raise( NotImplementedError, "#{self.class}##{__method__} must be implemented" ) end |
#generator ⇒ Object
File manipulation utility methods
60 61 62 63 |
# File 'lib/rubyists::opr/command.rb', line 60 def generator require 'tty-file' TTY::File end |
#pager(**options) ⇒ Object
Terminal output paging
70 71 72 73 |
# File 'lib/rubyists::opr/command.rb', line 70 def pager(**) require 'tty-pager' TTY::Pager.new() end |
#platform ⇒ Object
Terminal platform and OS properties
80 81 82 83 |
# File 'lib/rubyists::opr/command.rb', line 80 def platform require 'tty-platform' TTY::Platform.new end |
#prompt(**options) ⇒ Object
The interactive prompt
90 91 92 93 |
# File 'lib/rubyists::opr/command.rb', line 90 def prompt(**) require 'tty-prompt' TTY::Prompt.new() end |
#screen ⇒ Object
Get terminal screen properties
100 101 102 103 |
# File 'lib/rubyists::opr/command.rb', line 100 def screen require 'tty-screen' TTY::Screen end |
#which(*args) ⇒ Object
The unix which utility
110 111 112 113 |
# File 'lib/rubyists::opr/command.rb', line 110 def which(*args) require 'tty-which' TTY::Which.which(*args) end |