Module: Aka::Configuration::Shortcut

Defined in:
lib/aka/configuration.rb

Class Method Summary collapse

Class Method Details

.generate_output(row) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/aka/configuration.rb', line 18

def self.generate_output(row)
  string = if row.function
    <<-EOS.gsub(/^          /, '')
    function #{row.shortcut} {
      #{row.command}
    }
    EOS
  else
    %{alias #{row.shortcut}="#{row.command.gsub(%{"}, %{\\"})}"}
  end

  string
end

.parse(options) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'lib/aka/configuration.rb', line 8

def self.parse(options)
  OpenStruct.new.tap do |row|
    row.shortcut = options['shortcut']
    row.command = options['command']
    row.tag = options['tag'] if options['tag']
    row.description = options['description'] if options['description']
    row.function = options['function'] if options['function']
  end
end