class Gitdig::Command
Constants
- CONFIG_FILE
Public Instance Methods
The external commands runner
@see www.rubydoc.info/gems/tty-command
@api public
# File lib/gitdig/command.rb, line 28 def command(**options) require 'tty-command' TTY::Command.new(options) end
Config for the tool
# File lib/gitdig/command.rb, line 124 def configs require 'tty-config' @configs ||= TTY::Config.new.tap do |c| c.filename = CONFIG_FILE c.append_path Dir.pwd c.append_path Dir.home c.read end end
The cursor movement
@see www.rubydoc.info/gems/tty-cursor
@api public
# File lib/gitdig/command.rb, line 38 def cursor require 'tty-cursor' TTY::Cursor end
Open a file or text in the user's preferred editor
@see www.rubydoc.info/gems/tty-editor
@api public
# File lib/gitdig/command.rb, line 48 def editor require 'tty-editor' TTY::Editor end
Check if executable exists
@see www.rubydoc.info/gems/tty-which
@api public
# File lib/gitdig/command.rb, line 118 def exec_exist?(*args) require 'tty-which' TTY::Which.exist?(*args) end
Execute this command
@api public
# File lib/gitdig/command.rb, line 16 def execute(*) raise( NotImplementedError, "#{self.class}##{__method__} must be implemented" ) end
File manipulation utility methods
@see www.rubydoc.info/gems/tty-file
@api public
# File lib/gitdig/command.rb, line 58 def generator require 'tty-file' TTY::File end
Octokit client for Github
# File lib/gitdig/command.rb, line 135 def github_client require 'octokit' @github_client ||= Octokit::Client.new( access_token: configs.fetch(:token) ) end
Terminal output paging
@see www.rubydoc.info/gems/tty-pager
@api public
# File lib/gitdig/command.rb, line 68 def pager(**options) require 'tty-pager' TTY::Pager.new(options) end
Terminal platform and OS properties
@see www.rubydoc.info/gems/tty-pager
@api public
# File lib/gitdig/command.rb, line 78 def platform require 'tty-platform' TTY::Platform.new end
The interactive prompt
@see www.rubydoc.info/gems/tty-prompt
@api public
# File lib/gitdig/command.rb, line 88 def prompt(**options) require 'tty-prompt' TTY::Prompt.new(options) end
Get terminal screen properties
@see www.rubydoc.info/gems/tty-screen
@api public
# File lib/gitdig/command.rb, line 98 def screen require 'tty-screen' TTY::Screen end
The unix which utility
@see www.rubydoc.info/gems/tty-which
@api public
# File lib/gitdig/command.rb, line 108 def which(*args) require 'tty-which' TTY::Which.which(*args) end