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.

Instance Method Summary collapse

Constructor Details

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

Initialize.



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

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

#configure ⇒ Object



23
24
25
26
27
# File 'lib/sublime_text_kit/cli.rb', line 23

def configure
  
  say
  rebuild_session
end

#edit ⇒ Object



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

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

#help(task = nil) ⇒ Object



75
76
77
# File 'lib/sublime_text_kit/cli.rb', line 75

def help task = nil
  say && super
end

#metadata ⇒ Object



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

def 
  say

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

  say
end

#session ⇒ Object



32
33
34
35
36
37
38
39
40
41
# File 'lib/sublime_text_kit/cli.rb', line 32

def session
  say

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

  say
end

#version ⇒ Object



69
70
71
# File 'lib/sublime_text_kit/cli.rb', line 69

def version
  say SublimeTextKit::Identity.version_label
end