Class: OKF::CLI::Catalog
Overview
Every concept with its metadata, grouped by top-level dir. The widest of the read views, and the one the others narrow down from.
Constant Summary
Constants inherited from Command
OKF::CLI::Command::DUCK_TYPE, OKF::CLI::Command::FILTER_KEYS
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Command
Constructor Details
This class inherits a constructor from OKF::CLI::Command
Class Method Details
.group ⇒ Object
12 13 14 |
# File 'lib/okf/cli/catalog.rb', line 12 def self.group :read end |
.help_rows ⇒ Object
16 17 18 19 20 |
# File 'lib/okf/cli/catalog.rb', line 16 def self.help_rows [ [ "catalog <dir|@slug> [--json] [filters]", "list concepts with metadata, by top-level dir" ] ] end |
.id ⇒ Object
8 9 10 |
# File 'lib/okf/cli/catalog.rb', line 8 def self.id :catalog end |
Instance Method Details
#call(argv) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/okf/cli/catalog.rb', line 22 def call(argv) = { json: false } parser = OptionParser.new do |o| o. = "Usage: okf catalog <dir|@slug> [--type T] [--dir D] [--tag T] [--status S] [--trust T] [--json]" json_flags(o, , "emit the catalog as JSON") projection_flags(o, ) filter_flags(o, , :type, :area, :tag) help_flag(o) end dir = positional_dir(parser, argv) or return 2 folder = OKF::Bundle::Folder.load(dir) report_skipped(folder) entries = folder.catalog selected = filter_entries(entries, , dir_scope(folder, )) return print_catalog_json(dir, selected, ) if [:json] print_catalog(dir, selected, entries.size) 0 end |