cmdparse 3.0.2 → 3.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/COPYING +1 -1
- data/README.md +5 -5
- data/Rakefile +1 -2
- data/VERSION +1 -1
- data/doc/default.scss +49 -1
- data/doc/default.template +20 -14
- data/doc/index.page +1 -1
- data/doc/metainfo +9 -0
- data/doc/news.page +38 -0
- data/lib/cmdparse.rb +14 -6
- data/webgen.config +1 -1
- metadata +4 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 9d2caaf516131b40394d24f15510e829208323ceafb73e6bdf66230484c8fc54
|
4
|
+
data.tar.gz: 821bc8367ff510850f9cb2e4586d48d49c16d7d4ba0a2af97c8b582c32259dab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6a02d21a0267e5bb53b3fed534f40949a7d91d76caf3cea443af7d9169c8b88984332004d05c227df2248212a659df1bc0e16148cdfa66e1bc37883e3a236c11
|
7
|
+
data.tar.gz: e92d85dc7eb80cd8c4c99bb2937d0a4408e0e522a1716a5263daea3da427056caff4c244b6a1a546e81f6f17884884e414df11b5283998eb876bef06a634ef0d
|
data/COPYING
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
cmdparse - advanced command line parser supporting commands
|
2
|
-
Copyright (C) 2004-
|
2
|
+
Copyright (C) 2004-2020 Thomas Leitner <t_leitner@gmx.at>
|
3
3
|
|
4
4
|
Permission is hereby granted, free of charge, to any person obtaining a
|
5
5
|
copy of this software and associated documentation files (the
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
**cmdparse** - an advanced command line parser using optparse which has support for commands
|
2
2
|
|
3
|
-
Copyright (C) 2004-
|
3
|
+
Copyright (C) 2004-2020 Thomas Leitner
|
4
4
|
|
5
5
|
## Description
|
6
6
|
|
@@ -11,7 +11,7 @@ to create programs that use such a command line interface.
|
|
11
11
|
This library, cmdparse, can be used to create such a command line interface. Internally it uses
|
12
12
|
optparse to parse options and it provides a nice API for specifying commands.
|
13
13
|
|
14
|
-
See <
|
14
|
+
See <https://cmdparse.gettalong.org> for detailed information, an extensive tutorial and the API
|
15
15
|
reference!
|
16
16
|
|
17
17
|
|
@@ -21,14 +21,14 @@ You can build the documentation by invoking
|
|
21
21
|
|
22
22
|
$ rake doc
|
23
23
|
|
24
|
-
This builds the whole documentation and needs webgen >=1.4.0 (
|
24
|
+
This builds the whole documentation and needs webgen >=1.4.0 (https://webgen.gettalong.org) for
|
25
25
|
building.
|
26
26
|
|
27
27
|
|
28
28
|
## Example Usage
|
29
29
|
|
30
30
|
There is an example of how to use cmdparse in the `example/net.rb` file. A detailed walkthrough of
|
31
|
-
what each part does can be found on <
|
31
|
+
what each part does can be found on <https://cmdparse.gettalong.org/tutorial.html>.
|
32
32
|
|
33
33
|
|
34
34
|
## License
|
@@ -58,5 +58,5 @@ If you don't want to use RubyGems, use these commands:
|
|
58
58
|
|
59
59
|
Author: Thomas Leitner
|
60
60
|
|
61
|
-
* Web: <
|
61
|
+
* Web: <https://cmdparse.gettalong.org>
|
62
62
|
* e-Mail: <mailto:t_leitner@gmx.at>
|
data/Rakefile
CHANGED
@@ -107,13 +107,12 @@ namespace :dev do
|
|
107
107
|
s.add_development_dependency "webgen", "~> 1.4"
|
108
108
|
|
109
109
|
#### Documentation
|
110
|
-
s.has_rdoc = true
|
111
110
|
s.rdoc_options = ['--line-numbers', '--main', 'CmdParse::CommandParser']
|
112
111
|
|
113
112
|
#### Author and project details
|
114
113
|
s.author = "Thomas Leitner"
|
115
114
|
s.email = "t_leitner@gmx.at"
|
116
|
-
s.homepage = "
|
115
|
+
s.homepage = "https://cmdparse.gettalong.org"
|
117
116
|
end
|
118
117
|
|
119
118
|
Gem::PackageTask.new(spec) do |pkg|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.0.
|
1
|
+
3.0.7
|
data/doc/default.scss
CHANGED
@@ -270,7 +270,55 @@ $logo-color: #3A974D;
|
|
270
270
|
/***************************************/
|
271
271
|
/***************************************/
|
272
272
|
|
273
|
-
@
|
273
|
+
@font-face {
|
274
|
+
font-family: 'Source Sans Pro';
|
275
|
+
font-style: normal;
|
276
|
+
font-weight: 400;
|
277
|
+
src: local('Source Sans Pro Regular'), local('SourceSansPro-Regular'),
|
278
|
+
url('//static.gettalong.org/fonts/source-sans-pro-v11-latin-ext_latin-regular.woff2') format('woff2'),
|
279
|
+
url('//static.gettalong.org/fonts/source-sans-pro-v11-latin-ext_latin-regular.woff') format('woff'),
|
280
|
+
url('//static.gettalong.org/fonts/source-sans-pro-v11-latin-ext_latin-regular.ttf') format('truetype');
|
281
|
+
}
|
282
|
+
|
283
|
+
@font-face {
|
284
|
+
font-family: 'Source Sans Pro';
|
285
|
+
font-style: italic;
|
286
|
+
font-weight: 400;
|
287
|
+
src: local('Source Sans Pro Italic'), local('SourceSansPro-Italic'),
|
288
|
+
url('//static.gettalong.org/fonts/source-sans-pro-v11-latin-ext_latin-italic.woff2') format('woff2'),
|
289
|
+
url('//static.gettalong.org/fonts/source-sans-pro-v11-latin-ext_latin-italic.woff') format('woff'),
|
290
|
+
url('//static.gettalong.org/fonts/source-sans-pro-v11-latin-ext_latin-italic.ttf') format('truetype');
|
291
|
+
}
|
292
|
+
|
293
|
+
@font-face {
|
294
|
+
font-family: 'Source Sans Pro';
|
295
|
+
font-style: normal;
|
296
|
+
font-weight: 700;
|
297
|
+
src: local('Source Sans Pro Bold'), local('SourceSansPro-Bold'),
|
298
|
+
url('//static.gettalong.org/fonts/source-sans-pro-v11-latin-ext_latin-700.woff2') format('woff2'),
|
299
|
+
url('//static.gettalong.org/fonts/source-sans-pro-v11-latin-ext_latin-700.woff') format('woff'),
|
300
|
+
url('//static.gettalong.org/fonts/source-sans-pro-v11-latin-ext_latin-700.ttf') format('truetype');
|
301
|
+
}
|
302
|
+
|
303
|
+
@font-face {
|
304
|
+
font-family: 'Open Sans Condensed';
|
305
|
+
font-style: normal;
|
306
|
+
font-weight: 300;
|
307
|
+
src: local('Open Sans Condensed Light'), local('OpenSansCondensed-Light'),
|
308
|
+
url('//static.gettalong.org/fonts/open-sans-condensed-v12-latin-ext_latin-300.woff2') format('woff2'),
|
309
|
+
url('//static.gettalong.org/fonts/open-sans-condensed-v12-latin-ext_latin-300.woff') format('woff'),
|
310
|
+
url('//static.gettalong.org/fonts/open-sans-condensed-v12-latin-ext_latin-300.ttf') format('truetype');
|
311
|
+
}
|
312
|
+
|
313
|
+
@font-face {
|
314
|
+
font-family: 'Open Sans Condensed';
|
315
|
+
font-style: normal;
|
316
|
+
font-weight: 700;
|
317
|
+
src: local('Open Sans Condensed Bold'), local('OpenSansCondensed-Bold'),
|
318
|
+
url('//static.gettalong.org/fonts/open-sans-condensed-v12-latin-ext_latin-700.woff2') format('woff2'),
|
319
|
+
url('//static.gettalong.org/fonts/open-sans-condensed-v12-latin-ext_latin-700.woff') format('woff'),
|
320
|
+
url('//static.gettalong.org/fonts/open-sans-condensed-v12-latin-ext_latin-700.ttf') format('truetype');
|
321
|
+
}
|
274
322
|
|
275
323
|
/*********************************************************************************/
|
276
324
|
/* Basic */
|
data/doc/default.template
CHANGED
@@ -24,7 +24,7 @@
|
|
24
24
|
|
25
25
|
<!-- Sidebar -->
|
26
26
|
<div id="sidebar">
|
27
|
-
<h1 id="logo"><a href="{relocatable: /}">cmdparse</a><br /><span>v 3.0.
|
27
|
+
<h1 id="logo"><a href="{relocatable: /}">cmdparse</a><br /><span>v 3.0.7</span></h1>
|
28
28
|
|
29
29
|
<!-- Nav -->
|
30
30
|
<nav id="nav">
|
@@ -44,12 +44,13 @@
|
|
44
44
|
|
45
45
|
<!-- Copyright -->
|
46
46
|
<ul id="copyright">
|
47
|
-
<li itemscope="" itemtype="http://schema.org/Person">© 2004-
|
47
|
+
<li itemscope="" itemtype="http://schema.org/Person">© 2004-2020
|
48
48
|
<span itemprop="name">Thomas Leitner</span>
|
49
49
|
<meta itemprop="email" content="t_leitner@gmx.at" />
|
50
|
-
<meta itemprop="url" content="
|
50
|
+
<meta itemprop="url" content="https://gettalong.org" />
|
51
51
|
</li>
|
52
|
-
<li
|
52
|
+
<li><a href="https://gettalong.org/legal.html">Legal Notice</a> | <a href="https://gettalong.org/privacy.html">Privacy Policy</a></li>
|
53
|
+
<li>Generated by <a href="https://webgen.gettalong.org">webgen</a><br /> on <b>{date: }</b></li>
|
53
54
|
<li>Design based on<br />Striped by <a href="http://html5up.net">HTML5 UP</a></li>
|
54
55
|
</ul>
|
55
56
|
|
@@ -57,15 +58,20 @@
|
|
57
58
|
|
58
59
|
</div>
|
59
60
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
61
|
+
<script type="text/javascript">
|
62
|
+
var _paq = _paq || [];
|
63
|
+
_paq.push(["setDoNotTrack", true]);
|
64
|
+
_paq.push(['trackPageView']);
|
65
|
+
_paq.push(['enableLinkTracking']);
|
66
|
+
(function() {
|
67
|
+
var u="//stats.gettalong.org/";
|
68
|
+
_paq.push(['setTrackerUrl', u+'piwik.php']);
|
69
|
+
_paq.push(['setSiteId', '2']);
|
70
|
+
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
|
71
|
+
g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
|
72
|
+
})();
|
73
|
+
</script>
|
74
|
+
<noscript><p><img src="//stats.gettalong.org/piwik.php?idsite=2&rec=1" style="border:0;" alt="" /></p></noscript>
|
75
|
+
|
70
76
|
</body>
|
71
77
|
</html>
|
data/doc/index.page
CHANGED
data/doc/metainfo
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
--- paths
|
2
|
+
[/**/*.js, /**/*.css]:
|
3
|
+
modified_at_in_dest_path: true
|
4
|
+
|
5
|
+
/**/*.scss:
|
6
|
+
modified_at_in_dest_path: true
|
7
|
+
|
1
8
|
--- alcn
|
2
9
|
/api/:
|
3
10
|
title: API
|
@@ -12,3 +19,5 @@
|
|
12
19
|
/api/**/index*.html:
|
13
20
|
in_menu: false
|
14
21
|
|
22
|
+
/**/*.css:
|
23
|
+
pipeline: scss,cssminify
|
data/doc/news.page
CHANGED
@@ -5,6 +5,44 @@ sort_info: 8
|
|
5
5
|
---
|
6
6
|
## News
|
7
7
|
|
8
|
+
### 2020-12-08 cmdparse 3.0.7 released!
|
9
|
+
|
10
|
+
Changes:
|
11
|
+
|
12
|
+
* Behave well when interrupted via <kbd>Control+C</kbd> and when used in a pipe that gets closed
|
13
|
+
(thanks to postmodern)
|
14
|
+
|
15
|
+
|
16
|
+
### 2020-05-02 cmdparse 3.0.6 released!
|
17
|
+
|
18
|
+
Changes:
|
19
|
+
|
20
|
+
* Fix OptParse integration with regards to error handling (thanks to Damien Robert)
|
21
|
+
|
22
|
+
|
23
|
+
### 2020-01-31 cmdparse 3.0.5 released!
|
24
|
+
|
25
|
+
Changes:
|
26
|
+
|
27
|
+
* Fix warning on Ruby 2.7 (thanks to Damien Robert)
|
28
|
+
|
29
|
+
|
30
|
+
### 2018-12-22 cmdparse 3.0.4 released!
|
31
|
+
|
32
|
+
Changes:
|
33
|
+
|
34
|
+
* Fix bug in help output generation when a word is longer than the available space - thanks to
|
35
|
+
Damien Robert for the bug report and pull request
|
36
|
+
|
37
|
+
|
38
|
+
### 2017-01-13 cmdparse 3.0.3 released!
|
39
|
+
|
40
|
+
Changes:
|
41
|
+
|
42
|
+
* Fix bug introduced during refactoring that affected help output (continuation lines were missing)
|
43
|
+
- thanks to Andrew Talbot for reporting the bug
|
44
|
+
|
45
|
+
|
8
46
|
### 2016-12-28 cmdparse 3.0.2 released!
|
9
47
|
|
10
48
|
Changes:
|
data/lib/cmdparse.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#
|
2
2
|
#--
|
3
3
|
# cmdparse: advanced command line parser supporting commands
|
4
|
-
# Copyright (C) 2004-
|
4
|
+
# Copyright (C) 2004-2020 Thomas Leitner
|
5
5
|
#
|
6
6
|
# This file is part of cmdparse which is licensed under the MIT.
|
7
7
|
#++
|
@@ -47,7 +47,7 @@ end
|
|
47
47
|
module CmdParse
|
48
48
|
|
49
49
|
# The version of this cmdparse implemention
|
50
|
-
VERSION = '3.0.
|
50
|
+
VERSION = '3.0.7'.freeze
|
51
51
|
|
52
52
|
|
53
53
|
# Base class for all cmdparse errors.
|
@@ -157,6 +157,10 @@ module CmdParse
|
|
157
157
|
EOF
|
158
158
|
end
|
159
159
|
|
160
|
+
def get_candidates(id, &b)
|
161
|
+
@list.reverse_each {|list| list.get_candidates(id, &b)}
|
162
|
+
end
|
163
|
+
|
160
164
|
end
|
161
165
|
|
162
166
|
# === Base class for commands
|
@@ -624,8 +628,8 @@ module CmdParse
|
|
624
628
|
|
625
629
|
content.split(/\n\n/).map do |paragraph|
|
626
630
|
lines = []
|
627
|
-
|
628
|
-
unless (str = paragraph.slice!(pattern).sub(/[ \n]\z/, ''))
|
631
|
+
until paragraph.empty?
|
632
|
+
unless (str = paragraph.slice!(pattern)) and (str = str.sub(/[ \n]\z/, ''))
|
629
633
|
str = paragraph.slice!(0, line_length)
|
630
634
|
end
|
631
635
|
lines << (lines.empty? && !indent_first_line ? '' : ' ' * indent) + str.tr("\n", ' ')
|
@@ -841,8 +845,8 @@ module CmdParse
|
|
841
845
|
# Adds a top level command.
|
842
846
|
#
|
843
847
|
# See Command#add_command for detailed invocation information.
|
844
|
-
def add_command(*args, &block)
|
845
|
-
@main_command.add_command(*args, &block)
|
848
|
+
def add_command(*args, **kws, &block)
|
849
|
+
@main_command.add_command(*args, **kws, &block)
|
846
850
|
end
|
847
851
|
|
848
852
|
# Parses the command line arguments.
|
@@ -894,6 +898,10 @@ module CmdParse
|
|
894
898
|
@main_command.commands['help'].execute(*@current_command.command_chain.map(&:name))
|
895
899
|
end
|
896
900
|
exit(64) # FreeBSD standard exit error for "command was used incorrectly"
|
901
|
+
rescue Interrupt
|
902
|
+
exit(128 + 2)
|
903
|
+
rescue Errno::EPIPE
|
904
|
+
# Behave well when used in a pipe
|
897
905
|
ensure
|
898
906
|
@current_command = nil
|
899
907
|
end
|
data/webgen.config
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# -*- ruby -*-
|
2
2
|
|
3
|
-
website.config['website.base_url'] = '
|
3
|
+
website.config['website.base_url'] = 'https://cmdparse.gettalong.org/'
|
4
4
|
website.config['sources'] =[['/', :file_system, 'doc']]
|
5
5
|
website.config['destination'] = [:file_system, 'htmldoc']
|
6
6
|
website.config['website.tmpdir'] = 'webgen-tmp'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cmdparse
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thomas Leitner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-12-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: webgen
|
@@ -53,7 +53,7 @@ files:
|
|
53
53
|
- lib/cmdparse.rb
|
54
54
|
- setup.rb
|
55
55
|
- webgen.config
|
56
|
-
homepage:
|
56
|
+
homepage: https://cmdparse.gettalong.org
|
57
57
|
licenses:
|
58
58
|
- MIT
|
59
59
|
metadata: {}
|
@@ -75,8 +75,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
75
75
|
- !ruby/object:Gem::Version
|
76
76
|
version: '0'
|
77
77
|
requirements: []
|
78
|
-
|
79
|
-
rubygems_version: 2.6.8
|
78
|
+
rubygems_version: 3.0.3
|
80
79
|
signing_key:
|
81
80
|
specification_version: 4
|
82
81
|
summary: Advanced command line parser supporting commands
|