Class: OKF::CLI::Stats
Overview
Bundle rollups — concepts, types, areas, links, tags — in one screen.
Constant Summary
Constants inherited
from Command
Command::DUCK_TYPE
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Command
hidden?, #initialize
Class Method Details
.group ⇒ Object
11
12
13
|
# File 'lib/okf/cli/stats.rb', line 11
def self.group
:read
end
|
.help_rows ⇒ Object
15
16
17
18
19
|
# File 'lib/okf/cli/stats.rb', line 15
def self.help_rows
[
[ "stats <dir|@slug> [--json]", "bundle rollups (concepts, types, areas, links, tags)" ]
]
end
|
.id ⇒ Object
7
8
9
|
# File 'lib/okf/cli/stats.rb', line 7
def self.id
:stats
end
|
Instance Method Details
#call(argv) ⇒ Object
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/okf/cli/stats.rb', line 21
def call(argv)
options = { json: false }
parser = OptionParser.new do |o|
o.banner = "Usage: okf stats <dir|@slug> [--json]"
json_flags(o, options, "emit the stats as JSON")
help_flag(o)
end
dir = positional_dir(parser, argv) or return 2
folder = OKF::Bundle::Folder.load(dir)
report_skipped(folder)
stats = bundle_stats(folder)
options[:json] ? print_stats_json(dir, stats) : print_stats(dir, stats)
0
end
|