Class: SimpleCataloger::CmdUpdate

Inherits:
OptParseCommand::Command
  • Object
show all
Defined in:
lib/dircat/cat_on_sqlite_cli/cmd_update.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.commandObject



10
11
12
# File 'lib/dircat/cat_on_sqlite_cli/cmd_update.rb', line 10

def self.command
  "update"
end

.descriptionObject



14
15
16
# File 'lib/dircat/cat_on_sqlite_cli/cmd_update.rb', line 14

def self.description
  "update the content of catalog"
end

.usageObject



18
19
20
21
# File 'lib/dircat/cat_on_sqlite_cli/cmd_update.rb', line 18

def self.usage
  "#{command} <catalog name> <directory>"
  "Create a catalog with name <catalog name> starting from structure of <directory>"
end

Instance Method Details

#defaults(options) ⇒ Object



23
24
25
26
# File 'lib/dircat/cat_on_sqlite_cli/cmd_update.rb', line 23

def defaults(options)
  options.force = false
  options
end

#exec(main, options, rest) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/dircat/cat_on_sqlite_cli/cmd_update.rb', line 33

def exec(main, options, rest)
  if rest.length < 1
    puts "too few arguments"
    puts "-h to print help"
    return 0
  end

  catalog_name = rest[0]

  catalog = CatOnSqlite.new(catalog_name)
  catalog.update

  0
end

#option_parser(options) ⇒ Object



28
29
30
31
# File 'lib/dircat/cat_on_sqlite_cli/cmd_update.rb', line 28

def option_parser(options)
  parser = super(options)
  parser
end