Class: Kojo::Commands::DirCmd

Inherits:
CommandBase
  • Object
show all
Defined in:
lib/kojo/commands/dir.rb

Overview

Handle calls to the kojo dir command

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from CommandBase

#save

Instance Attribute Details

#import_baseObject (readonly)

Returns the value of attribute import_base.



9
10
11
# File 'lib/kojo/commands/dir.rb', line 9

def import_base
  @import_base
end

#indirObject (readonly)

Returns the value of attribute indir.



9
10
11
# File 'lib/kojo/commands/dir.rb', line 9

def indir
  @indir
end

#optsObject (readonly)

Returns the value of attribute opts.



9
10
11
# File 'lib/kojo/commands/dir.rb', line 9

def opts
  @opts
end

#outdirObject (readonly)

Returns the value of attribute outdir.



9
10
11
# File 'lib/kojo/commands/dir.rb', line 9

def outdir
  @outdir
end

Instance Method Details

#runObject



28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/kojo/commands/dir.rb', line 28

def run
  @opts = args['ARGS'].args_to_hash
  @indir = args['INDIR']
  @outdir = args['--save']
  @import_base = args['--imports']
  argfile = args['--args']

  if argfile
    fileopts = YAML.load_file(argfile).symbolize_keys
    @opts = fileopts.merge @opts
  end

  run!
end