super_docopt 0.1.0 → 0.2.0

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: b208dfe9dafa0e901eb87a96fa96a76c188fef825503cb5be5a8cb0965157e87
4
- data.tar.gz: d4ea792a397b4e149ec38399af01a1120ebaf016f3a360cb658f7026a207b13b
3
+ metadata.gz: 556c14534c6e62e2a508387a141ca629048a543bc8b2a16bdba47880a63d0fd4
4
+ data.tar.gz: c832a020c2cf4c527fdbac014c8c249f6849d728afa7f15b90ee0490c201d449
5
5
  SHA512:
6
- metadata.gz: cd9c66bda7521ae87d621e5134bd3ed1b0d2545fddc9baf46b98ea2f646b392f5645e9cf7da8980d2b1350dc9643b17d5e29639e128c23fb7b5a20433de89dc9
7
- data.tar.gz: fbf6f682020997cdf125f516977521c2f73071903e5e109cb4167385ac771bf250882a637b197c27f66ce4c4b7ef56c0383c67b3d226e8d8429825c9c478726b
6
+ metadata.gz: 5d634beb5b71cc725979b80e7d314864e1625b4984dd5edabfe7b74ad0406c53aef1751db5fd83cb95825348f5127871c714bef9518d1342aa6a6aff6a80ccf7
7
+ data.tar.gz: bed43e205b8d88a9c74cfc22abbbe9ae9f27ceb15b818f4fd1c49b7e43dc7fdd34ef8a3837f7b562585f7949bfa86812b2c11d245143e9cde5582628825e7cf3
data/README.md CHANGED
@@ -1,10 +1,9 @@
1
1
  Super Docopt
2
2
  ==================================================
3
3
 
4
- [![Gem](https://img.shields.io/gem/v/super_docopt.svg?style=flat-square)](https://rubygems.org/gems/super_docopt)
5
- [![Build](https://img.shields.io/travis/DannyBen/super_docopt.svg?style=flat-square)](https://travis-ci.org/DannyBen/super_docopt)
6
- [![Maintainability](https://img.shields.io/codeclimate/maintainability/DannyBen/super_docopt.svg?style=flat-square)](https://codeclimate.com/github/DannyBen/super_docopt)
7
- [![Issues](https://img.shields.io/codeclimate/issues/github/DannyBen/super_docopt.svg?style=flat-square)](https://codeclimate.com/github/DannyBen/super_docopt)
4
+ [![Gem Version](https://badge.fury.io/rb/super_docopt.svg)](https://badge.fury.io/rb/super_docopt)
5
+ [![Build Status](https://github.com/DannyBen/super_docopt/workflows/Test/badge.svg)](https://github.com/DannyBen/super_docopt/actions?query=workflow%3ATest)
6
+ [![Maintainability](https://api.codeclimate.com/v1/badges/2ca07d88e6f7b0b57e82/maintainability)](https://codeclimate.com/github/DannyBen/super_docopt/maintainability)
8
7
 
9
8
  ---
10
9
 
@@ -16,10 +15,10 @@ Create command line utilities with ease.
16
15
  Install
17
16
  --------------------------------------------------
18
17
 
19
- $ gem install runfile
18
+ $ gem install super_docopt
20
19
 
21
20
 
22
- Example
21
+ Getting Started
23
22
  --------------------------------------------------
24
23
 
25
24
  ```ruby
@@ -31,14 +30,16 @@ class MyCommandLine < SuperDocopt::Base
31
30
  docopt 'docopt.txt'
32
31
  subcommands ['download', 'upload']
33
32
 
34
- def download(args)
33
+ def download
35
34
  puts "#download called with #{args}"
36
35
  end
37
36
 
38
- def upload(args)
37
+ def upload
39
38
  puts "#upload called"
40
39
  end
41
40
  end
41
+
42
+ MyCommandLine.execute ARGV
42
43
  ```
43
44
 
44
45
  ```plain
@@ -51,11 +52,8 @@ Usage:
51
52
  mock (-h|--help|--version)
52
53
  ```
53
54
 
54
- Usage
55
- --------------------------------------------------
56
-
57
- Soon
55
+ See the [examples](/examples) folder for more examples.
58
56
 
59
57
  ---
60
58
 
61
- [1]: http://docopt.org/
59
+ [1]: http://docopt.org/
@@ -1,5 +1,5 @@
1
1
  require 'singleton'
2
- require 'docopt'
2
+ require 'docopt_ng'
3
3
 
4
4
  module SuperDocopt
5
5
  class Base
@@ -8,7 +8,7 @@ module SuperDocopt
8
8
  attr_reader :args
9
9
  attr_accessor :version, :docopt, :subcommands
10
10
 
11
- def self.execute(argv=[])
11
+ def self.execute(argv = [])
12
12
  instance.execute_cli argv
13
13
  end
14
14
 
@@ -24,28 +24,27 @@ module SuperDocopt
24
24
  instance.subcommands = list
25
25
  end
26
26
 
27
- def execute_cli(argv=[])
27
+ def execute_cli(argv = [])
28
28
  doc = File.read docopt
29
29
  begin
30
- @args = Docopt::docopt(doc, argv: argv, version: version)
30
+ @args = DocoptNG.docopt(doc, argv: argv, version: version)
31
31
  handle_subcommand
32
- rescue Docopt::Exit => e
32
+ rescue DocoptNG::Exit => e
33
33
  puts e.message
34
34
  end
35
35
  end
36
36
 
37
- private
37
+ private
38
38
 
39
39
  def handle_subcommand
40
40
  subcommands.each do |subcommand|
41
41
  input, method = translate_subcommand subcommand
42
- return execute_subcommand input, method if args[input]
42
+ return execute_subcommand method if args[input]
43
43
  end
44
44
  end
45
45
 
46
- def execute_subcommand(input, method)
47
- raise NotImplementedError,
48
- "Please implement ##{method}" unless respond_to? method
46
+ def execute_subcommand(method)
47
+ raise NotImplementedError, "Please implement ##{method}" unless respond_to? method
49
48
 
50
49
  before_execute
51
50
  send method
@@ -61,8 +60,8 @@ module SuperDocopt
61
60
  method = subcommand.values.first.to_s
62
61
  end
63
62
 
64
- input = input.gsub '_', '-'
65
- method = method.gsub '-', '_'
63
+ input = input.tr '_', '-'
64
+ method = method.tr '-', '_'
66
65
 
67
66
  [input, method]
68
67
  end
@@ -72,4 +71,4 @@ module SuperDocopt
72
71
  def before_execute; end
73
72
  def after_execute; end
74
73
  end
75
- end
74
+ end
@@ -1,3 +1,3 @@
1
1
  module SuperDocopt
2
- VERSION = '0.1.0'
3
- end
2
+ VERSION = '0.2.0'
3
+ end
metadata CHANGED
@@ -1,127 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: super_docopt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Danny Ben Shitrit
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-02-10 00:00:00.000000000 Z
11
+ date: 2023-02-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: docopt
14
+ name: docopt_ng
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.6'
19
+ version: '0.7'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0.6'
27
- - !ruby/object:Gem::Dependency
28
- name: runfile
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: '0.10'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: '0.10'
41
- - !ruby/object:Gem::Dependency
42
- name: runfile-tasks
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: '0.4'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: '0.4'
55
- - !ruby/object:Gem::Dependency
56
- name: rspec
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: '3.6'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: '3.6'
69
- - !ruby/object:Gem::Dependency
70
- name: rspec_fixtures
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "~>"
74
- - !ruby/object:Gem::Version
75
- version: '0.3'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - "~>"
81
- - !ruby/object:Gem::Version
82
- version: '0.3'
83
- - !ruby/object:Gem::Dependency
84
- name: simplecov
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - "~>"
88
- - !ruby/object:Gem::Version
89
- version: '0.15'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - "~>"
95
- - !ruby/object:Gem::Version
96
- version: '0.15'
97
- - !ruby/object:Gem::Dependency
98
- name: byebug
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - "~>"
102
- - !ruby/object:Gem::Version
103
- version: '9.0'
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - "~>"
109
- - !ruby/object:Gem::Version
110
- version: '9.0'
111
- - !ruby/object:Gem::Dependency
112
- name: require_all
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - "~>"
116
- - !ruby/object:Gem::Version
117
- version: '1.5'
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - "~>"
123
- - !ruby/object:Gem::Version
124
- version: '1.5'
26
+ version: '0.7'
125
27
  description: Extension to docopt for defining command line utilities with ease
126
28
  email: db@dannyben.com
127
29
  executables: []
@@ -135,7 +37,8 @@ files:
135
37
  homepage: https://github.com/DannyBen/super_docopt
136
38
  licenses:
137
39
  - MIT
138
- metadata: {}
40
+ metadata:
41
+ rubygems_mfa_required: 'true'
139
42
  post_install_message:
140
43
  rdoc_options: []
141
44
  require_paths:
@@ -144,15 +47,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
144
47
  requirements:
145
48
  - - ">="
146
49
  - !ruby/object:Gem::Version
147
- version: 2.0.0
50
+ version: '2.7'
148
51
  required_rubygems_version: !ruby/object:Gem::Requirement
149
52
  requirements:
150
53
  - - ">="
151
54
  - !ruby/object:Gem::Version
152
55
  version: '0'
153
56
  requirements: []
154
- rubyforge_project:
155
- rubygems_version: 2.7.3
57
+ rubygems_version: 3.4.6
156
58
  signing_key:
157
59
  specification_version: 4
158
60
  summary: docopt-based command line utility builder