Class: OKF::CLI::Files
Overview
Every file with its title, grouped by folder — the view for "what is on disk" rather than "what is modelled".
Constant Summary
Constants inherited from Command
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/files.rb', line 12 def self.group :read end |
.help_rows ⇒ Object
16 17 18 19 20 |
# File 'lib/okf/cli/files.rb', line 16 def self.help_rows [ [ "files <dir|@slug> [--json] [filters]", "list files with titles, by folder" ] ] end |
.id ⇒ Object
8 9 10 |
# File 'lib/okf/cli/files.rb', line 8 def self.id :files 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/files.rb', line 22 def call(argv) = { json: false } parser = OptionParser.new do |o| o. = "Usage: okf files <dir|@slug> [--type T] [--area A] [--tag T] [--json]" json_flags(o, , "emit the file tree 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, ) return print_files_json(dir, selected, ) if [:json] print_files(dir, selected, entries.size) 0 end |