Class: Kuberun::Command

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/kuberun/command.rb

Direct Known Subclasses

Kuberun::Commands::RunPod

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Command

Returns a new instance of Command.



11
12
13
# File 'lib/kuberun/command.rb', line 11

def initialize(options)
  Kuberun::Kubectl.load_options(options)
end

Instance Method Details

#command(**options) ⇒ Object

The external commands runner



30
31
32
33
# File 'lib/kuberun/command.rb', line 30

def command(**options)
  require 'tty-command'
  TTY::Command.new(options)
end

#cursorObject

The cursor movement



40
41
42
43
# File 'lib/kuberun/command.rb', line 40

def cursor
  require 'tty-cursor'
  TTY::Cursor
end

#editorObject

Open a file or text in the user’s preferred editor



50
51
52
53
# File 'lib/kuberun/command.rb', line 50

def editor
  require 'tty-editor'
  TTY::Editor
end

#exec_exist?(*args) ⇒ Boolean

Check if executable exists

Returns:

  • (Boolean)

See Also:



120
121
122
123
# File 'lib/kuberun/command.rb', line 120

def exec_exist?(*args)
  require 'tty-which'
  TTY::Which.exist?(*args)
end

#executeObject

Execute this command

Raises:

  • (NotImplementedError)


18
19
20
21
22
23
# File 'lib/kuberun/command.rb', line 18

def execute(*)
  raise(
    NotImplementedError,
    "#{self.class}##{__method__} must be implemented"
  )
end

#generatorObject

File manipulation utility methods



60
61
62
63
# File 'lib/kuberun/command.rb', line 60

def generator
  require 'tty-file'
  TTY::File
end

#pager(**options) ⇒ Object

Terminal output paging



70
71
72
73
# File 'lib/kuberun/command.rb', line 70

def pager(**options)
  require 'tty-pager'
  TTY::Pager.new(options)
end

#platformObject

Terminal platform and OS properties



80
81
82
83
# File 'lib/kuberun/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/kuberun/command.rb', line 90

def prompt(**options)
  require 'tty-prompt'
  TTY::Prompt.new(options)
end

#screenObject

Get terminal screen properties



100
101
102
103
# File 'lib/kuberun/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/kuberun/command.rb', line 110

def which(*args)
  require 'tty-which'
  TTY::Which.which(*args)
end