como 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/lib/como.rb CHANGED
@@ -815,7 +815,7 @@ module Como
815
815
  when :opt_single; prims = [ :one, :opt ]
816
816
  when :opt_multi; prims = [ :one, :many, :opt ]
817
817
  when :opt_any; prims = [ :none, :one, :many, :opt ]
818
- when :default; prims = [ :none, :one, :many, :default, :opt ]
818
+ when :default; prims = [ :none, :one, :many, :opt, :default ]
819
819
  when :exclusive; prims = [ :none, :one, :many, :opt, :mutex ]
820
820
  when :silent; prims = [ :none, :opt, :hidden ]
821
821
  else
@@ -1421,10 +1421,17 @@ module Como
1421
1421
  # Search for default option.
1422
1422
  o = findOpt( nil )
1423
1423
  if !o
1424
- raise \
1425
- InvalidOption.new(
1426
- "No default option specified to allow \"#{args.get}\"...",
1427
- self )
1424
+ if @subcmd.any?
1425
+ raise \
1426
+ InvalidOption.new(
1427
+ "Unknown subcmd: \"#{args.get}\"...",
1428
+ self )
1429
+ else
1430
+ raise \
1431
+ InvalidOption.new(
1432
+ "No default option specified to allow \"#{args.get}\"...",
1433
+ self )
1434
+ end
1428
1435
  else
1429
1436
  # Default option.
1430
1437
  o.given = true
@@ -1890,13 +1897,13 @@ module Como
1890
1897
  # Find option object by option str.
1891
1898
  def findOpt( str )
1892
1899
  if str == nil
1893
- suball.detect { |i| i.prim?( :default ) }
1900
+ subopt.detect { |i| i.prim?( :default ) }
1894
1901
  elsif str[0..1] == "--"
1895
- suball.detect { |i| i.longOpt == str }
1896
- elsif str[0..0] != "-"
1897
- suball.detect { |i| i.name == str }
1902
+ subopt.detect { |i| i.longOpt == str }
1903
+ elsif str[0..0] == "-"
1904
+ subopt.detect { |i| i.opt == str }
1898
1905
  else
1899
- suball.detect { |i| i.opt == str }
1906
+ suball.detect { |i| i.name == str }
1900
1907
  end
1901
1908
  end
1902
1909
 
@@ -2158,7 +2165,6 @@ module Como
2158
2165
  @idx >= @list.length
2159
2166
  end
2160
2167
 
2161
-
2162
2168
  # Test whether str is an option.
2163
2169
  def isOpt( str = get )
2164
2170
  str[0..0] == "-"
data/lib/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Como
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  def Como.version
4
4
  Como::VERSION
5
5
  end
@@ -364,3 +364,21 @@ Options for: commit
364
364
  Given "<default>": true
365
365
  Value "<default>": ["foo"]
366
366
  External: ["external", "arguments"]
367
+ ---- CMD: como_subcmd foo
368
+
369
+ como_subcmd error: Unknown subcmd: "foo"...
370
+
371
+ como_subcmd [-p <password>] [-u <username>+] <<subcommand>>
372
+
373
+ Options:
374
+ -p User password.
375
+ -u Username(s).
376
+
377
+ Subcommands:
378
+ add Add file to repo.
379
+ rm Remove file from repo.
380
+ commit Commit (pending) changes to repo.
381
+
382
+
383
+ Copyright (c) 2013 by Como Tester
384
+
data/test/test_como.rb CHANGED
@@ -21,7 +21,7 @@ def runTest( test )
21
21
  end
22
22
 
23
23
  new_golden = true
24
- # Uncomment the next code line to generate new goldens.
24
+ # Comment the next code line to generate new goldens.
25
25
  # WARNING: Only generate new goldens after careful inspection.
26
26
  new_golden = false
27
27
 
data/test/test_subcmd CHANGED
@@ -28,3 +28,5 @@ como_subcmd commit -h -u user1 dii duu -h
28
28
  como_subcmd commit -u user1 dii duu -h
29
29
 
30
30
  como_subcmd -p foo commit foo -- external arguments
31
+
32
+ como_subcmd foo
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: como
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-07-15 00:00:00.000000000 Z
12
+ date: 2017-01-01 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: ! 'Como provides low manifest command line option parsing and deployment.
15
15
  The command line options are described in compact table format and option values