cl 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/{cli.rb → cl.rb} +4 -4
- data/lib/{cli → cl}/cmd.rb +2 -2
- data/lib/{cli → cl}/cmds.rb +3 -3
- data/lib/{cli → cl}/format/cmd.rb +3 -3
- data/lib/{cli → cl}/format/list.rb +3 -3
- data/lib/{cli → cl}/format/table.rb +1 -1
- data/lib/{cli → cl}/format/usage.rb +1 -1
- data/lib/{cli → cl}/help.rb +6 -6
- data/lib/{cli → cl}/options.rb +1 -1
- data/lib/{cli → cl}/registry.rb +3 -3
- data/lib/{cli → cl}/runner.rb +2 -2
- data/lib/cl/version.rb +3 -0
- metadata +13 -13
- data/lib/cli/version.rb +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7dbb945fc479c46219fa0aa0f57b6b3a6ed935de
|
4
|
+
data.tar.gz: d7011478b8db611917ad9adc6826e787b425f3e2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eb8c51c3e073bc619f3c2247c085a2b0b40e32eb3acfc6deeb1a4a1a5054ed2cbedbb68056d2d3950c3da01fcfca6609ba33e2d1790929811880f0b5b8bdeebe
|
7
|
+
data.tar.gz: b8eff80a773703c9921fdddc59d41c0c5b6bfc8e58e3359f9b13130735329d6f8acf24ed70fa381a88af6492b798016f756e4fb6c39908b00bd0501b55c773bf
|
data/lib/{cli.rb → cl.rb}
RENAMED
data/lib/{cli → cl}/cmd.rb
RENAMED
data/lib/{cli → cl}/cmds.rb
RENAMED
@@ -1,6 +1,6 @@
|
|
1
|
-
require '
|
1
|
+
require 'cl/options'
|
2
2
|
|
3
|
-
module
|
3
|
+
module Cl
|
4
4
|
class Cmds < Struct.new(:args)
|
5
5
|
def lookup
|
6
6
|
cmd || abort("Unknown command: #{args.join(' ')}")
|
@@ -18,7 +18,7 @@ module Cli
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def cmd
|
21
|
-
@cmd ||= keys.map { |key|
|
21
|
+
@cmd ||= keys.map { |key| Cl[key] }.compact.last
|
22
22
|
end
|
23
23
|
|
24
24
|
def keys
|
data/lib/{cli → cl}/help.rb
RENAMED
@@ -1,9 +1,9 @@
|
|
1
|
-
require '
|
2
|
-
require '
|
1
|
+
require 'cl/format/cmd'
|
2
|
+
require 'cl/format/list'
|
3
3
|
|
4
|
-
module
|
4
|
+
module Cl
|
5
5
|
class Help < Struct.new(:args, :opts)
|
6
|
-
include
|
6
|
+
include Cl::Cmd
|
7
7
|
|
8
8
|
register :help
|
9
9
|
|
@@ -18,14 +18,14 @@ module Cli
|
|
18
18
|
private
|
19
19
|
|
20
20
|
def cmds
|
21
|
-
cmds =
|
21
|
+
cmds = Cl.cmds.reject { |cmd| cmd.registry_key == :help }
|
22
22
|
key = args.join(':') if args
|
23
23
|
cmds = cmds.select { |cmd| cmd.registry_key.to_s.start_with?(key) } if key
|
24
24
|
cmds
|
25
25
|
end
|
26
26
|
|
27
27
|
def cmd
|
28
|
-
args &&
|
28
|
+
args && Cl[args.join(':')]
|
29
29
|
end
|
30
30
|
end
|
31
31
|
end
|
data/lib/{cli → cl}/options.rb
RENAMED
data/lib/{cli → cl}/registry.rb
RENAMED
@@ -1,4 +1,4 @@
|
|
1
|
-
module
|
1
|
+
module Cl
|
2
2
|
class << self
|
3
3
|
def []=(key, object)
|
4
4
|
registry[key.to_sym] = object
|
@@ -29,11 +29,11 @@ module Cli
|
|
29
29
|
attr_reader :registry_key
|
30
30
|
|
31
31
|
def [](key)
|
32
|
-
|
32
|
+
Cl[key.to_sym]
|
33
33
|
end
|
34
34
|
|
35
35
|
def register(key)
|
36
|
-
|
36
|
+
Cl[key] = self
|
37
37
|
@registry_key = key.to_sym
|
38
38
|
end
|
39
39
|
|
data/lib/{cli → cl}/runner.rb
RENAMED
data/lib/cl/version.rb
ADDED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sven Fuchs
|
@@ -20,18 +20,18 @@ files:
|
|
20
20
|
- Gemfile.lock
|
21
21
|
- MIT_LICENSE.md
|
22
22
|
- README.md
|
23
|
-
- lib/
|
24
|
-
- lib/
|
25
|
-
- lib/
|
26
|
-
- lib/
|
27
|
-
- lib/
|
28
|
-
- lib/
|
29
|
-
- lib/
|
30
|
-
- lib/
|
31
|
-
- lib/
|
32
|
-
- lib/
|
33
|
-
- lib/
|
34
|
-
- lib/
|
23
|
+
- lib/cl.rb
|
24
|
+
- lib/cl/cmd.rb
|
25
|
+
- lib/cl/cmds.rb
|
26
|
+
- lib/cl/format/cmd.rb
|
27
|
+
- lib/cl/format/list.rb
|
28
|
+
- lib/cl/format/table.rb
|
29
|
+
- lib/cl/format/usage.rb
|
30
|
+
- lib/cl/help.rb
|
31
|
+
- lib/cl/options.rb
|
32
|
+
- lib/cl/registry.rb
|
33
|
+
- lib/cl/runner.rb
|
34
|
+
- lib/cl/version.rb
|
35
35
|
homepage: https://github.com/svenfuchs/cl
|
36
36
|
licenses:
|
37
37
|
- MIT
|
data/lib/cli/version.rb
DELETED