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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2f86887c16aed295c0207a4c5005decf8fd1cc05
4
- data.tar.gz: 12260c6e0abc90a6b2df31fd3ce1797189953539
3
+ metadata.gz: 7dbb945fc479c46219fa0aa0f57b6b3a6ed935de
4
+ data.tar.gz: d7011478b8db611917ad9adc6826e787b425f3e2
5
5
  SHA512:
6
- metadata.gz: b4277518e42daa3e8f19bf612ffdae68c6244e28a043915e1842fdc28b200493e5fbe41f821b2040443f861e7e8cafae0d705b08d592b7cfd2dcc51cc719a73e
7
- data.tar.gz: 54a224126510e271f4847ffc6a089cb130af5ac00e0c50c8d001e1d183f8c5d2ebd8c3dd48b56742764503c7379ef4bf06333994d195b4f82496c81d956e475e
6
+ metadata.gz: eb8c51c3e073bc619f3c2247c085a2b0b40e32eb3acfc6deeb1a4a1a5054ed2cbedbb68056d2d3950c3da01fcfca6609ba33e2d1790929811880f0b5b8bdeebe
7
+ data.tar.gz: b8eff80a773703c9921fdddc59d41c0c5b6bfc8e58e3359f9b13130735329d6f8acf24ed70fa381a88af6492b798016f756e4fb6c39908b00bd0501b55c773bf
@@ -1,8 +1,8 @@
1
- require 'cli/cmd'
2
- require 'cli/help'
3
- require 'cli/runner'
1
+ require 'cl/cmd'
2
+ require 'cl/help'
3
+ require 'cl/runner'
4
4
 
5
- module Cli
5
+ module Cl
6
6
  def included(const)
7
7
  const.send(:include, Cmd)
8
8
  end
@@ -1,6 +1,6 @@
1
- require 'cli/registry'
1
+ require 'cl/registry'
2
2
 
3
- module Cli
3
+ module Cl
4
4
  module Cmd
5
5
  def self.included(const)
6
6
  const.send :include, Registry
@@ -1,6 +1,6 @@
1
- require 'cli/options'
1
+ require 'cl/options'
2
2
 
3
- module Cli
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| Cli[key] }.compact.last
21
+ @cmd ||= keys.map { |key| Cl[key] }.compact.last
22
22
  end
23
23
 
24
24
  def keys
@@ -1,7 +1,7 @@
1
- require 'cli/format/table'
2
- require 'cli/format/usage'
1
+ require 'cl/format/table'
2
+ require 'cl/format/usage'
3
3
 
4
- module Cli
4
+ module Cl
5
5
  class Format
6
6
  class Cmd < Struct.new(:cmd)
7
7
  def format
@@ -1,7 +1,7 @@
1
- require 'cli/format/table'
2
- require 'cli/format/usage'
1
+ require 'cl/format/table'
2
+ require 'cl/format/usage'
3
3
 
4
- module Cli
4
+ module Cl
5
5
  class Format
6
6
  class List < Struct.new(:cmds)
7
7
  HEAD = %(Type "#{$0} help COMMAND [SUBCOMMAND]" for more details:\n)
@@ -1,4 +1,4 @@
1
- module Cli
1
+ module Cl
2
2
  class Format
3
3
  class Table < Struct.new(:data, :separator)
4
4
  def format
@@ -1,4 +1,4 @@
1
- module Cli
1
+ module Cl
2
2
  class Format
3
3
  class Usage < Struct.new(:cmd)
4
4
  def format
@@ -1,9 +1,9 @@
1
- require 'cli/format/cmd'
2
- require 'cli/format/list'
1
+ require 'cl/format/cmd'
2
+ require 'cl/format/list'
3
3
 
4
- module Cli
4
+ module Cl
5
5
  class Help < Struct.new(:args, :opts)
6
- include Cli::Cmd
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 = Cli.cmds.reject { |cmd| cmd.registry_key == :help }
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 && Cli[args.join(':')]
28
+ args && Cl[args.join(':')]
29
29
  end
30
30
  end
31
31
  end
@@ -1,4 +1,4 @@
1
- module Cli
1
+ module Cl
2
2
  class Options < OptionParser
3
3
  attr_reader :opts
4
4
 
@@ -1,4 +1,4 @@
1
- module Cli
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
- Cli[key.to_sym]
32
+ Cl[key.to_sym]
33
33
  end
34
34
 
35
35
  def register(key)
36
- Cli[key] = self
36
+ Cl[key] = self
37
37
  @registry_key = key.to_sym
38
38
  end
39
39
 
@@ -1,6 +1,6 @@
1
- require 'cli/cmds'
1
+ require 'cl/cmds'
2
2
 
3
- module Cli
3
+ module Cl
4
4
  class Runner
5
5
  attr_reader :const, :args, :opts
6
6
 
@@ -0,0 +1,3 @@
1
+ module Cl
2
+ VERSION = '0.0.2'
3
+ end
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.1
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/cli.rb
24
- - lib/cli/cmd.rb
25
- - lib/cli/cmds.rb
26
- - lib/cli/format/cmd.rb
27
- - lib/cli/format/list.rb
28
- - lib/cli/format/table.rb
29
- - lib/cli/format/usage.rb
30
- - lib/cli/help.rb
31
- - lib/cli/options.rb
32
- - lib/cli/registry.rb
33
- - lib/cli/runner.rb
34
- - lib/cli/version.rb
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
@@ -1,3 +0,0 @@
1
- module Cli
2
- VERSION = '0.0.1'
3
- end