Class: Tlux::Commands::OpenCommand

Inherits:
Base
  • Object
show all
Defined in:
lib/tlux/commands/open_command.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#config_path, #setup

Constructor Details

#initialize(config_name) ⇒ OpenCommand

Returns a new instance of OpenCommand.



6
7
8
# File 'lib/tlux/commands/open_command.rb', line 6

def initialize(config_name)
  @config_name = config_name
end

Instance Attribute Details

#config_nameObject (readonly)

Returns the value of attribute config_name.



4
5
6
# File 'lib/tlux/commands/open_command.rb', line 4

def config_name
  @config_name
end

Instance Method Details

#run(open_editor = true) ⇒ Object



10
11
12
13
14
15
# File 'lib/tlux/commands/open_command.rb', line 10

def run(open_editor = true)
  setup
  create_config unless File.exists?(config_file_path)
  raise Tlux::EditorNotDefinedError unless editor
  exec "#{editor} #{config_file_path}" if open_editor
end