Class: SublimeTextKit::CLI

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

Instance Method Summary collapse

Constructor Details

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

Initialize.



12
13
14
15
16
# File 'lib/sublime_text_kit/cli.rb', line 12

def initialize args = [], options = {}, config = {}
  super args, options, config
  @settings_file = File.join ENV.fetch("HOME"), ".sublime", "settings.yml"
  @settings = load_yaml @settings_file
end

Instance Method Details

#editObject



50
51
52
# File 'lib/sublime_text_kit/cli.rb', line 50

def edit
  `#{editor} #{@settings_file}`
end

#help(task = nil) ⇒ Object



62
63
64
# File 'lib/sublime_text_kit/cli.rb', line 62

def help task = nil
  say and super
end

#projectObject



22
23
24
25
26
27
28
29
30
31
32
# File 'lib/sublime_text_kit/cli.rb', line 22

def project
  say

  case
    when options[:create] then 
    when options[:destroy] then 
    else help("--project")
  end

  say
end

#sessionObject



37
38
39
40
41
42
43
44
45
46
# File 'lib/sublime_text_kit/cli.rb', line 37

def session
  say

  case
    when options[:rebuild_recent_workspaces] then rebuild_recent_workspaces
    else help("--session")
  end

  say
end

#versionObject



56
57
58
# File 'lib/sublime_text_kit/cli.rb', line 56

def version
  say "Sublime Text Kit " + VERSION
end