Class: SublimeTextKit::CLI

Inherits:
Thor
  • Object
show all
Includes:
Thor::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.



19
20
21
# File 'lib/sublime_text_kit/cli.rb', line 19

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

Class Method Details

.configuration ⇒ Object



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

def self.configuration
  Runcom::Configuration.new project_name: Identity.name
end

Instance Method Details

#config ⇒ Object



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

def config
  path = self.class.configuration.path

  if options.edit? then `#{ENV["EDITOR"]} #{path}`
  elsif options.info?
    path ? say(path) : say("Configuration doesn't exist.")
  else help(:config)
  end
end

#help(task = nil) ⇒ Object



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

def help task = nil
  say and super
end

#metadata ⇒ Object



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

def 
  say

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

  say
end

#session ⇒ Object



38
39
40
41
42
# File 'lib/sublime_text_kit/cli.rb', line 38

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

#update ⇒ Object



25
26
27
28
29
# File 'lib/sublime_text_kit/cli.rb', line 25

def update
  
  say
  rebuild_session
end

#version ⇒ Object



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

def version
  say Identity.version_label
end