Skip to content

Commit 0f00852

Browse files
committed
Update CLI so that patch command name and patch option are not the same, using patch_input instead.
1 parent d1da2c2 commit 0f00852

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

lib/ld/patch/format.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,26 +21,26 @@ def self.cli_commands
2121
{
2222
patch: {
2323
description: "Patch the current graph using a patch file",
24-
help: "patch [--patch 'patch'] [--patch-file file]",
24+
help: "patch [--patch-input 'patch'] [--patch-file file]",
2525
control: :button,
2626
parse: true,
2727
lambda: -> (argv, opts) do
28-
opts[:patch] ||= case opts[:patch_file]
28+
opts[:patch_input] ||= case opts[:patch_file]
2929
when IO, StringIO then opts[:patch_file]
3030
else RDF::Util::File.open_file(opts[:patch_file]) {|f| f.read}
3131
end
32-
raise ArgumentError, "Patching requires a URI encoded patch or reference to patch resource" unless opts[:patch]
32+
raise ArgumentError, "Patching requires a patch or reference to patch resource" unless opts[:patch_input]
3333
opts[:logger].info "Patch"
34-
patch = LD::Patch.parse(opts[:patch], base_uri: opts.fetch(:patch_file, "http://rubygems.org/gems/ld-patch"))
35-
opts[:messages][:"S-Expression"] = [patch.to_sse]
34+
patch = LD::Patch.parse(opts[:patch_input], base_uri: opts.fetch(:patch_file, "http://rubygems.org/gems/ld-patch"))
35+
opts[:messages][:"S-Expression"] = [patch.to_sse] if opts[:to_sxp]
3636
RDF::CLI.repository.query(patch)
3737
end,
3838
options: [
3939
RDF::CLI::Option.new(
40-
symbol: :patch,
40+
symbol: :patch_input,
4141
datatype: String,
4242
control: :none,
43-
on: ["--patch STRING"],
43+
on: ["--patch-input STRING"],
4444
description: "Patch in URI encoded format"
4545
) {|v| URI.decode(v)},
4646
RDF::CLI::Option.new(
@@ -56,7 +56,7 @@ def self.cli_commands
5656
control: :checkbox,
5757
on: ["--to-sxp"],
5858
description: "Instead of patching repository, display parsed patch as an S-Expression"
59-
) {|v| RDF::URI(v)},
59+
),
6060
]
6161
}
6262
}

0 commit comments

Comments
 (0)