Class: SimpleCataloger::CmdList
- Inherits:
-
OptParseCommand::Command
- Object
- OptParseCommand::Command
- SimpleCataloger::CmdList
- Defined in:
- lib/dircat/cat_on_sqlite_cli/cmd_list.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.command ⇒ Object
7 8 9 |
# File 'lib/dircat/cat_on_sqlite_cli/cmd_list.rb', line 7 def self.command "list" end |
.description ⇒ Object
11 12 13 |
# File 'lib/dircat/cat_on_sqlite_cli/cmd_list.rb', line 11 def self.description "list items in catalog" end |
.usage ⇒ Object
15 16 17 18 |
# File 'lib/dircat/cat_on_sqlite_cli/cmd_list.rb', line 15 def self.usage "#{command} <catalog name> <directory>\n" + "Create a catalog with name <catalog name> starting from structure of <directory>" end |
Instance Method Details
#defaults(options) ⇒ Object
20 21 22 23 |
# File 'lib/dircat/cat_on_sqlite_cli/cmd_list.rb', line 20 def defaults() .force = false end |
#exec(main, options, rest) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/dircat/cat_on_sqlite_cli/cmd_list.rb', line 30 def exec(main, , rest) if rest.length < 1 puts "too few arguments" puts "-h to print help" return 0 end catalog_name = rest[0] cat_opts = {} # begin catalog = CatOnSqlite.new(catalog_name).open puts "contains of '#{catalog.name}'" puts "categories" Category.all.each do |c| puts "\t #{c.name}" end # Category.find_by_name("Actor").items.each do |i| # pp i # end # # Tags # puts "tags" Tag.all.each do |t| puts "\t #{t.name} (category: #{t.category.name})" end puts "items" Item.all.each do |f| puts "\t #{f.name}" end # rescue e # puts e.message # end 0 end |
#option_parser(options) ⇒ Object
25 26 27 28 |
# File 'lib/dircat/cat_on_sqlite_cli/cmd_list.rb', line 25 def option_parser() parser = super() parser end |