Class: FIS::Command
- Inherits:
-
Object
- Object
- FIS::Command
- Extended by:
- Forwardable
- Defined in:
- lib/fis/command.rb
Overview
Inheritable helpers for common command tasks
Direct Known Subclasses
FIS::CLI::Commands::Login, FIS::CLI::Commands::Logout, FIS::CLI::Commands::Whoami
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 Method Details
#command(**options) ⇒ Object
The external commands runner
25 26 27 28 |
# File 'lib/fis/command.rb', line 25 def command(**) require 'tty-command' TTY::Command.new() end |
#cursor ⇒ Object
The cursor movement
35 36 37 38 |
# File 'lib/fis/command.rb', line 35 def cursor require 'tty-cursor' TTY::Cursor end |
#editor ⇒ Object
Open a file or text in the user’s preferred editor
45 46 47 48 |
# File 'lib/fis/command.rb', line 45 def editor require 'tty-editor' TTY::Editor end |
#exec_exist?(*args) ⇒ Boolean
Check if executable exists
115 116 117 118 |
# File 'lib/fis/command.rb', line 115 def exec_exist?(*args) require 'tty-which' TTY::Which.exist?(*args) end |
#execute ⇒ Object
Execute this command
13 14 15 16 17 18 |
# File 'lib/fis/command.rb', line 13 def execute(*) raise( NotImplementedError, "#{self.class}##{__method__} must be implemented" ) end |
#generator ⇒ Object
File manipulation utility methods
55 56 57 58 |
# File 'lib/fis/command.rb', line 55 def generator require 'tty-file' TTY::File end |
#pager(**options) ⇒ Object
Terminal output paging
65 66 67 68 |
# File 'lib/fis/command.rb', line 65 def pager(**) require 'tty-pager' TTY::Pager.new() end |
#platform ⇒ Object
Terminal platform and OS properties
75 76 77 78 |
# File 'lib/fis/command.rb', line 75 def platform require 'tty-platform' TTY::Platform.new end |
#prompt(**options) ⇒ Object
The interactive prompt
85 86 87 88 |
# File 'lib/fis/command.rb', line 85 def prompt(**) require 'tty-prompt' TTY::Prompt.new() end |
#screen ⇒ Object
Get terminal screen properties
95 96 97 98 |
# File 'lib/fis/command.rb', line 95 def screen require 'tty-screen' TTY::Screen end |
#which(*args) ⇒ Object
The unix which utility
105 106 107 108 |
# File 'lib/fis/command.rb', line 105 def which(*args) require 'tty-which' TTY::Which.which(*args) end |