Skip to content

Commit 311b34a

Browse files
committed
Add option defaults for CLI.
1 parent 6676107 commit 311b34a

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

lib/json/ld/reader.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def self.options
2121
on: ["--expand-context CONTEXT"],
2222
description: "Context to use when expanding.") {|arg| RDF::URI(arg)},
2323
RDF::CLI::Option.new(
24-
symbol: :processing_mode,
24+
symbol: :processingMode,
2525
datatype: %w(json-ld-1.0 json-ld-1.1),
2626
control: :radio,
2727
on: ["--processingMode MODE", %w(json-ld-1.0 json-ld-1.1)],

lib/json/ld/writer.rb

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,14 @@ def self.options
7575
RDF::CLI::Option.new(
7676
symbol: :compactArrays,
7777
datatype: TrueClass,
78+
default: true,
7879
control: :checkbox,
7980
on: ["--[no-]compact-arrays"],
8081
description: "Replaces arrays with just one element with that element during compaction. Default is `true` use --no-compact-arrays to disable.") {|arg| arg},
8182
RDF::CLI::Option.new(
8283
symbol: :compactToRelative,
8384
datatype: TrueClass,
85+
default: true,
8486
control: :checkbox,
8587
on: ["--[no-]compact-to-relative"],
8688
description: "Creates document relative IRIs when compacting, if `true`, otherwise leaves expanded. Default is `true` use --no-compact-to-relative to disable.") {|arg| arg},
@@ -93,42 +95,48 @@ def self.options
9395
RDF::CLI::Option.new(
9496
symbol: :embed,
9597
datatype: %w(@always @last @never),
98+
default: '@last',
9699
control: :select,
97100
on: ["--embed EMBED"],
98101
description: "How to embed matched objects (@last).") {|arg| RDF::URI(arg)},
99102
RDF::CLI::Option.new(
100103
symbol: :explicit,
101104
datatype: TrueClass,
105+
default: false,
102106
control: :checkbox,
103107
on: ["--[no-]explicit"],
104108
description: "Only include explicitly declared properties in output (false)") {|arg| arg},
105109
RDF::CLI::Option.new(
106110
symbol: :omitDefault,
107111
datatype: TrueClass,
112+
default: false,
108113
control: :checkbox,
109114
on: ["--[no-]omitDefault"],
110115
description: "Omit missing properties from output (false)") {|arg| arg},
111116
RDF::CLI::Option.new(
112-
symbol: :processing_mode,
117+
symbol: :processingMode,
113118
datatype: %w(json-ld-1.0 json-ld-1.1),
114119
control: :radio,
115120
on: ["--processingMode MODE", %w(json-ld-1.0 json-ld-1.1)],
116121
description: "Set Processing Mode (json-ld-1.0 or json-ld-1.1)"),
117122
RDF::CLI::Option.new(
118123
symbol: :requireAll,
119124
datatype: TrueClass,
125+
default: true,
120126
control: :checkbox,
121127
on: ["--[no-]requireAll"],
122128
description: "Require all properties to match (true). Default is `true` use --no-compact-to-relative to disable.") {|arg| arg},
123129
RDF::CLI::Option.new(
124130
symbol: :stream,
125131
datatype: TrueClass,
132+
default: false,
126133
control: :checkbox,
127134
on: ["--[no-]stream"],
128135
description: "Do not attempt to optimize graph presentation, suitable for streaming large graphs.") {|arg| arg},
129136
RDF::CLI::Option.new(
130137
symbol: :useRdfType,
131138
datatype: TrueClass,
139+
default: false,
132140
control: :checkbox,
133141
on: ["--[no-]use-rdf-type"],
134142
description: "Treat `rdf:type` like a normal property instead of using `@type`.") {|arg| arg},

0 commit comments

Comments
 (0)