clamp 1.3.3 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGES.md +9 -0
- data/README.md +45 -1
- data/examples/gitdown +1 -0
- data/lib/clamp/completion/bash_generator.rb +141 -0
- data/lib/clamp/completion/fish_generator.rb +75 -0
- data/lib/clamp/completion/zsh_generator.rb +126 -0
- data/lib/clamp/completion.rb +163 -0
- data/lib/clamp/version.rb +1 -1
- metadata +7 -23
- data/.autotest +0 -11
- data/.editorconfig +0 -10
- data/.gitignore +0 -9
- data/.rspec +0 -2
- data/.rubocop.yml +0 -71
- data/.travis.yml +0 -6
- data/CODEOWNERS +0 -1
- data/Gemfile +0 -20
- data/Guardfile +0 -45
- data/Rakefile +0 -18
- data/clamp.gemspec +0 -28
- data/spec/clamp/command_group_spec.rb +0 -438
- data/spec/clamp/command_option_module_spec.rb +0 -40
- data/spec/clamp/command_option_reordering_spec.rb +0 -58
- data/spec/clamp/command_spec.rb +0 -1280
- data/spec/clamp/help/builder_spec.rb +0 -81
- data/spec/clamp/messages_spec.rb +0 -50
- data/spec/clamp/option/definition_spec.rb +0 -343
- data/spec/clamp/parameter/definition_spec.rb +0 -314
- data/spec/spec_helper.rb +0 -65
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require "spec_helper"
|
|
4
|
-
|
|
5
|
-
describe Clamp::Command do
|
|
6
|
-
|
|
7
|
-
extend CommandFactory
|
|
8
|
-
include OutputCapture
|
|
9
|
-
|
|
10
|
-
context "with allow_options_after_parameters enabled" do
|
|
11
|
-
|
|
12
|
-
before do
|
|
13
|
-
Clamp.allow_options_after_parameters = true
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
after do
|
|
17
|
-
Clamp.allow_options_after_parameters = false
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
given_command("cmd") do
|
|
21
|
-
|
|
22
|
-
option ["-v", "--verbose"], :flag, "Be noisy"
|
|
23
|
-
|
|
24
|
-
subcommand "say", "Say something" do
|
|
25
|
-
|
|
26
|
-
option "--loud", :flag, "say it loud"
|
|
27
|
-
|
|
28
|
-
parameter "WORDS ...", "the thing to say", attribute_name: :words
|
|
29
|
-
|
|
30
|
-
def execute
|
|
31
|
-
message = words.join(" ")
|
|
32
|
-
message = message.upcase if loud?
|
|
33
|
-
message *= 3 if verbose?
|
|
34
|
-
$stdout.puts message
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
it "still works" do
|
|
42
|
-
command.run(%w[say foo])
|
|
43
|
-
expect(stdout).to eq "foo\n"
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
it "honours options after positional arguments" do
|
|
47
|
-
command.run(%w[say blah --verbose])
|
|
48
|
-
expect(stdout).to eq "blahblahblah\n"
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
it "honours options declared on subcommands" do
|
|
52
|
-
command.run(%w[say --loud blah])
|
|
53
|
-
expect(stdout).to eq "BLAH\n"
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
end
|