Class: SublimeTextKit::CLI

Inherits:
Thor
  • Object
show all
Includes:
Thor::Actions, ThorPlus::Actions
Defined in:
lib/sublime_text_kit/cli.rb

Overview

The Command Line Interface (CLI) for the gem.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = [], options = {}, config = {}) ⇒ CLI

Initialize.



21
22
23
# File 'lib/sublime_text_kit/cli.rb', line 21

def initialize args = [], options = {}, config = {}
  super args, options, config
end

Class Method Details

.configurationObject



16
17
18
# File 'lib/sublime_text_kit/cli.rb', line 16

def self.configuration
  Runcom::Configuration.new file_name: Identity.file_name
end

Instance Method Details

#configObject



73
74
75
76
77
78
79
80
# File 'lib/sublime_text_kit/cli.rb', line 73

def config
  path = self.class.configuration.computed_path

  if options.edit? then `#{editor} #{path}`
  elsif options.info? then say(path)
  else help(:config)
  end
end

#help(task = nil) ⇒ Object



90
91
92
# File 'lib/sublime_text_kit/cli.rb', line 90

def help task = nil
  say and super
end

#metadataObject



51
52
53
54
55
56
57
58
59
60
61
# File 'lib/sublime_text_kit/cli.rb', line 51

def 
  say

  if options[:create] then 
  elsif options[:destroy] then 
  elsif options[:rebuild] then 
  else help("--metadata")
  end

  say
end

#sessionObject



40
41
42
43
44
# File 'lib/sublime_text_kit/cli.rb', line 40

def session
  say
  options.rebuild? ? rebuild_session : help("--session")
  say
end

#updateObject



27
28
29
30
31
# File 'lib/sublime_text_kit/cli.rb', line 27

def update
  
  say
  rebuild_session
end

#versionObject



84
85
86
# File 'lib/sublime_text_kit/cli.rb', line 84

def version
  say Identity.version_label
end