Class: Ninny::Command

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

Instance Method Summary collapse

Instance Method Details

#command(**options) ⇒ Object

The external commands runner



24
25
26
27
# File 'lib/ninny/command.rb', line 24

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

#cursorObject

The cursor movement



34
35
36
37
# File 'lib/ninny/command.rb', line 34

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

#editorObject

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



44
45
46
47
# File 'lib/ninny/command.rb', line 44

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

#exec_exist?(*args) ⇒ Boolean

Check if executable exists

Returns:

  • (Boolean)

See Also:



114
115
116
117
# File 'lib/ninny/command.rb', line 114

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

#executeObject

Execute this command

Raises:

  • (NotImplementedError)


12
13
14
15
16
17
# File 'lib/ninny/command.rb', line 12

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

#generatorObject

File manipulation utility methods



54
55
56
57
# File 'lib/ninny/command.rb', line 54

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

#pager(**options) ⇒ Object

Terminal output paging



64
65
66
67
# File 'lib/ninny/command.rb', line 64

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

#platformObject

Terminal platform and OS properties



74
75
76
77
# File 'lib/ninny/command.rb', line 74

def platform
  require 'tty-platform'
  TTY::Platform.new
end

#prompt(**options) ⇒ Object

The interactive prompt



84
85
86
87
# File 'lib/ninny/command.rb', line 84

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

#screenObject

Get terminal screen properties



94
95
96
97
# File 'lib/ninny/command.rb', line 94

def screen
  require 'tty-screen'
  TTY::Screen
end

#which(*args) ⇒ Object

The unix which utility



104
105
106
107
# File 'lib/ninny/command.rb', line 104

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