class Moneylovercli::Command

Public Instance Methods

command(**options) click to toggle source

The external commands runner

@see www.rubydoc.info/gems/tty-command

@api public

# File lib/moneylovercli/command.rb, line 30
def command(**options)
  require 'tty-command'
  TTY::Command.new(options)
end
config() click to toggle source
# File lib/moneylovercli/command.rb, line 125
def config
  require 'tty-config'
  require 'tty-file'
  config_dir = "#{Dir.home}/.config/moneylovercli"
  TTY::File.create_dir(config_dir)

  @config ||= begin
    config = TTY::Config.new
    config.filename = 'config'
    config.extname = '.yml'
    # config.append_path(Dir.pwd)
    config.append_path(config_dir)
    config
  end
end
cursor() click to toggle source

The cursor movement

@see www.rubydoc.info/gems/tty-cursor

@api public

# File lib/moneylovercli/command.rb, line 40
def cursor
  require 'tty-cursor'
  TTY::Cursor
end
editor() click to toggle source

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

@see www.rubydoc.info/gems/tty-editor

@api public

# File lib/moneylovercli/command.rb, line 50
def editor
  require 'tty-editor'
  TTY::Editor
end
exec_exist?(*args) click to toggle source

Check if executable exists

@see www.rubydoc.info/gems/tty-which

@api public

# File lib/moneylovercli/command.rb, line 120
def exec_exist?(*args)
  require 'tty-which'
  TTY::Which.exist?(*args)
end
execute(*) click to toggle source

Execute this command

@api public

# File lib/moneylovercli/command.rb, line 18
def execute(*)
  raise(
    NotImplementedError,
    "#{self.class}##{__method__} must be implemented"
  )
end
generator() click to toggle source

File manipulation utility methods

@see www.rubydoc.info/gems/tty-file

@api public

# File lib/moneylovercli/command.rb, line 60
def generator
  require 'tty-file'
  TTY::File
end
pager(**options) click to toggle source

Terminal output paging

@see www.rubydoc.info/gems/tty-pager

@api public

# File lib/moneylovercli/command.rb, line 70
def pager(**options)
  require 'tty-pager'
  TTY::Pager.new(options)
end
platform() click to toggle source

Terminal platform and OS properties

@see www.rubydoc.info/gems/tty-pager

@api public

# File lib/moneylovercli/command.rb, line 80
def platform
  require 'tty-platform'
  TTY::Platform.new
end
prompt(**options) click to toggle source

The interactive prompt

@see www.rubydoc.info/gems/tty-prompt

@api public

# File lib/moneylovercli/command.rb, line 90
def prompt(**options)
  require 'tty-prompt'
  TTY::Prompt.new(options)
end
screen() click to toggle source

Get terminal screen properties

@see www.rubydoc.info/gems/tty-screen

@api public

# File lib/moneylovercli/command.rb, line 100
def screen
  require 'tty-screen'
  TTY::Screen
end
which(*args) click to toggle source

The unix which utility

@see www.rubydoc.info/gems/tty-which

@api public

# File lib/moneylovercli/command.rb, line 110
def which(*args)
  require 'tty-which'
  TTY::Which.which(*args)
end