Class: Teamocil::CLI

Inherits:
Object
  • Object
show all
Defined in:
lib/teamocil/cli.rb

Constant Summary collapse

DIRECTORY =
'$HOME/.teamocil'

Instance Method Summary collapse

Instance Method Details

#run!Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/teamocil/cli.rb', line 5

def run!
  Teamocil.parse_options!(arguments: arguments)

  # List available layouts
  return Teamocil::Layout.print_available_layouts(directory: root) if Teamocil.options[:list]

  # Fetch the Layout object
  layout = Teamocil::Layout.new(path: layout_file_path)

  # Open layout file in $EDITOR
  return layout.edit! if Teamocil.options[:edit]

  # Output the layout raw content
  return layout.show! if Teamocil.options[:show]

  # Nothing? Let’s execute this layout!
  layout.execute!
end