Class: Monte::Command
- Inherits:
-
Object
- Object
- Monte::Command
- Extended by:
- Forwardable
- Defined in:
- lib/monte/command.rb
Direct Known Subclasses
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.
- #large_title(title) ⇒ Object
-
#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.
- #table(headers, rows) ⇒ Object
-
#which(*args) ⇒ Object
The unix which utility.
Instance Method Details
#command(**options) ⇒ Object
The external commands runner
26 27 28 29 |
# File 'lib/monte/command.rb', line 26 def command(**) require 'tty-command' TTY::Command.new() end |
#cursor ⇒ Object
The cursor movement
36 37 38 39 |
# File 'lib/monte/command.rb', line 36 def cursor require 'tty-cursor' TTY::Cursor end |
#editor ⇒ Object
Open a file or text in the user’s preferred editor
46 47 48 49 |
# File 'lib/monte/command.rb', line 46 def editor require 'tty-editor' TTY::Editor end |
#exec_exist?(*args) ⇒ Boolean
Check if executable exists
116 117 118 119 |
# File 'lib/monte/command.rb', line 116 def exec_exist?(*args) require 'tty-which' TTY::Which.exist?(*args) end |
#execute ⇒ Object
Execute this command
14 15 16 17 18 19 |
# File 'lib/monte/command.rb', line 14 def execute(*) raise( NotImplementedError, "#{self.class}##{__method__} must be implemented" ) end |
#generator ⇒ Object
File manipulation utility methods
56 57 58 59 |
# File 'lib/monte/command.rb', line 56 def generator require 'tty-file' TTY::File end |
#large_title(title) ⇒ Object
126 127 128 129 |
# File 'lib/monte/command.rb', line 126 def large_title(title) require 'tty-font' TTY::Font.new(:standard).write(title) end |
#pager(**options) ⇒ Object
Terminal output paging
66 67 68 69 |
# File 'lib/monte/command.rb', line 66 def pager(**) require 'tty-pager' TTY::Pager.new() end |
#platform ⇒ Object
Terminal platform and OS properties
76 77 78 79 |
# File 'lib/monte/command.rb', line 76 def platform require 'tty-platform' TTY::Platform.new end |
#prompt(**options) ⇒ Object
The interactive prompt
86 87 88 89 |
# File 'lib/monte/command.rb', line 86 def prompt(**) require 'tty-prompt' TTY::Prompt.new() end |
#screen ⇒ Object
Get terminal screen properties
96 97 98 99 |
# File 'lib/monte/command.rb', line 96 def screen require 'tty-screen' TTY::Screen end |
#table(headers, rows) ⇒ Object
121 122 123 124 |
# File 'lib/monte/command.rb', line 121 def table(headers, rows) require 'tty-table' TTY::Table.new(headers, rows) end |
#which(*args) ⇒ Object
The unix which utility
106 107 108 109 |
# File 'lib/monte/command.rb', line 106 def which(*args) require 'tty-which' TTY::Which.which(*args) end |