simple-cli 0.3.4 → 0.3.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 396da74801c8dbe4910923bec2ad720181966e27c543afee855ff15b8e807f28
4
- data.tar.gz: f2f1d11130bd1b2ac43c40308c71eaec78a148662ab65ce55b5dcbdaa201834c
3
+ metadata.gz: 292083d093cfa8d19af7fc9e0b36836f14c92626eb94e58b040835b6f1014477
4
+ data.tar.gz: aa539e6a99d170ec549f2b71a7e8bc2d97a95a3bb72bf460e24d3ca50c8ccb08
5
5
  SHA512:
6
- metadata.gz: 10b9f1865828bba3102bd0a93f711d99449923a6d8159597035dd552174411c0c3286071c69005fe400948f10acb534ed87ba9a7e436647f36b47e49c6337953
7
- data.tar.gz: 6c36d0894fc438c4058824239db56020b8075193daa6638f93587e712c8e2dfa128999b56bde2802c2d23dace843800cab7f8c98d94cc6c3a1d5ebf4ee5a8d89
6
+ metadata.gz: a7e572dc5f719e9d93fb65c3d87a5632e2155acabcc26c95b11d94b56fe086432f8792ff2baa9aaf091835829cbfd241e8543ee9823f95b68abb39f4efe98b62
7
+ data.tar.gz: c8f80db886151142e5886605132901e5991ec7e9c313b507d513fc5d6690114b471dec8d471b88aa40147653ae1e770eb4745d54141b8ab000d4fd36ef5ff6a6
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.4
1
+ 0.3.5
@@ -10,7 +10,7 @@ module Simple::CLI
10
10
 
11
11
  MSG
12
12
 
13
- subcommands = actions.map { |action| "'" + H.action_to_command(action.name) + "'" }
13
+ subcommands = actions.map { |action| "'" + H.action_to_command(action.name) + "'" }
14
14
  msg = "Subcommands include #{subcommands.sort.join(", ")}"
15
15
  msg += " (and an additional #{hidden_actions.count} internal commands)"
16
16
 
@@ -8,7 +8,7 @@ module Simple::CLI
8
8
  action_name = H.command_to_action(command)
9
9
  Simple::Service.with_context do
10
10
  flags = extract_flags!(args)
11
- ::Simple::Service.invoke(service, action_name, *args, **flags)
11
+ ::Simple::Service.invoke(service, action_name, args: args, flags: flags)
12
12
  end
13
13
  end
14
14
 
@@ -24,14 +24,30 @@ module Simple::CLI
24
24
  def extract_flags!(args)
25
25
  flags = {}
26
26
 
27
+ had_path_separator = false
28
+
27
29
  args.reject! do |arg|
30
+ # path separator? When encountering "--" all following arguments are
31
+ # considered not flags.
32
+ #
33
+ # We set the had_path_separator flag (to remember that we have seen it,
34
+ # but then `next true` regardless because we need to remove the argument
35
+ # from the +args+ array.
36
+ if arg == "--"
37
+ had_path_separator = true
38
+ next true
39
+ end
40
+ break if had_path_separator
41
+
42
+ # Doesn't look like an argument?
28
43
  next false unless arg =~ /^--(no-)?([^=]+)(=(.+))?/
29
44
 
45
+ # Extract the flag, and its value (false, true, or a String)
30
46
  flag_name = $2.tr("-", "_")
31
47
  flag_name = "no_#{flag_name}" if $4 && $1
32
48
  value = $4 || ($1 ? false : true)
33
49
 
34
- flags[flag_name.to_sym] = value
50
+ flags[flag_name] = value
35
51
  true
36
52
  end
37
53
 
@@ -27,7 +27,7 @@ Gem::Specification.new do |gem|
27
27
  gem.required_ruby_version = '~> 2.3'
28
28
 
29
29
  # optional gems (required by some of the parts)
30
- gem.add_dependency "simple-service", "~> 0.1.4"
30
+ gem.add_dependency "simple-service", "~> 0.1.5"
31
31
 
32
32
  # development gems
33
33
  gem.add_development_dependency 'rake', '~> 12'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
4
+ version: 0.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - radiospiel
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-12-03 00:00:00.000000000 Z
12
+ date: 2019-12-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: simple-service
@@ -17,14 +17,14 @@ dependencies:
17
17
  requirements:
18
18
  - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: 0.1.4
20
+ version: 0.1.5
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - "~>"
26
26
  - !ruby/object:Gem::Version
27
- version: 0.1.4
27
+ version: 0.1.5
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: rake
30
30
  requirement: !ruby/object:Gem::Requirement