Class: OKF::CLI::Loose
Overview
List the "loose" files — concepts with graph degree 0 (no cross-links in or
out), grouped by folder. A folder-grouped view over lint's unlinked check,
for the common "which files float in the graph?" question. Advisory (exit 0):
a terminal leaf can be loose by design. --json for a machine substrate.
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
14
15
16
|
# File 'lib/okf/cli/loose.rb', line 14
def self.group
:judge
end
|
.help_rows ⇒ Object
18
19
20
21
22
|
# File 'lib/okf/cli/loose.rb', line 18
def self.help_rows
[
[ "loose <dir|@slug> [--json]", "list files with no graph links, by folder" ]
]
end
|
.id ⇒ Object
10
11
12
|
# File 'lib/okf/cli/loose.rb', line 10
def self.id
:loose
end
|
Instance Method Details
#call(argv) ⇒ Object
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/okf/cli/loose.rb', line 24
def call(argv)
options = { json: false }
parser = OptionParser.new do |o|
o.banner = "Usage: okf loose <dir|@slug> [--json]"
json_flags(o, options, "emit the loose files as JSON")
help_flag(o)
end
dir = positional_dir(parser, argv) or return 2
folder = OKF::Bundle::Folder.load(dir)
report_skipped(folder)
files = loose_files(folder.graph(minimal: true))
options[:json] ? print_loose_json(dir, files) : print_loose(dir, files)
0
end
|