cmdparse 2.0.6 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/COPYING +21 -674
- data/README.md +29 -26
- data/Rakefile +58 -94
- data/VERSION +1 -1
- data/doc/api.api +5 -0
- data/doc/api.template +24 -0
- data/doc/default.scss +1987 -0
- data/doc/default.template +47 -26
- data/doc/images/bg01.png +0 -0
- data/doc/images/bg02.png +0 -0
- data/doc/index.page +81 -74
- data/doc/{download.page → installation.page} +13 -14
- data/doc/metainfo +14 -0
- data/doc/news.page +113 -0
- data/doc/tutorial.page +211 -115
- data/doc/virtual +2 -5
- data/example/net.rb +85 -0
- data/lib/cmdparse.rb +675 -284
- data/webgen.config +22 -0
- metadata +39 -24
- data/COPYING.LESSER +0 -165
- data/doc/about.page +0 -24
- data/doc/default.css +0 -152
- data/doc/logo.png +0 -0
- data/lib/cmdparse/wrappers/optparse.rb +0 -63
- data/net.rb +0 -88
- data/test/tc_commandhash.rb +0 -96
data/webgen.config
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
|
3
|
+
website.config['website.base_url'] = 'http://cmdparse.gettalong.org/'
|
4
|
+
website.config['sources'] =[['/', :file_system, 'doc']]
|
5
|
+
website.config['destination'] = [:file_system, 'htmldoc']
|
6
|
+
website.config['website.tmpdir'] = 'webgen-tmp'
|
7
|
+
website.config['content_processor.kramdown.options'] = {
|
8
|
+
syntax_highlighter: 'coderay',
|
9
|
+
syntax_highlighter_opts: {css: 'class', line_numbers: nil}
|
10
|
+
}
|
11
|
+
website.config['content_processor.sass.options'] = {:style => :compressed}
|
12
|
+
|
13
|
+
website.config.define_option('tag.extract.file', 'example/net.rb')
|
14
|
+
website.config.define_option('tag.extract.lines', nil)
|
15
|
+
|
16
|
+
website.ext.tag.register('extract', :config_prefix => 'tag.extract',
|
17
|
+
:mandatory => ['lines']) do |tag, body, context|
|
18
|
+
|
19
|
+
file = context[:config]['tag.extract.file']
|
20
|
+
lines = context[:config]['tag.extract.lines']
|
21
|
+
File.readlines(File.join(context.website.directory, file)).unshift('unused line')[lines].join("").rstrip
|
22
|
+
end
|
metadata
CHANGED
@@ -1,66 +1,81 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cmdparse
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thomas Leitner
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
12
|
-
dependencies:
|
11
|
+
date: 2015-03-12 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: webgen
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.4'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.4'
|
13
27
|
description: |2
|
14
|
-
cmdparse provides classes for parsing commands on the command line;
|
15
|
-
are parsed using optparse
|
16
|
-
such command line interfaces are, for example, subversion's 'svn' or Rubygem's 'gem' program.
|
28
|
+
cmdparse provides classes for parsing (possibly nested) commands on the command line;
|
29
|
+
command line options themselves are parsed using optparse.
|
17
30
|
email: t_leitner@gmx.at
|
18
31
|
executables: []
|
19
32
|
extensions: []
|
20
33
|
extra_rdoc_files: []
|
21
34
|
files:
|
22
|
-
- setup.rb
|
23
35
|
- COPYING
|
24
|
-
- COPYING.LESSER
|
25
36
|
- README.md
|
26
37
|
- Rakefile
|
27
|
-
- net.rb
|
28
38
|
- VERSION
|
29
|
-
-
|
30
|
-
-
|
31
|
-
- doc/
|
32
|
-
- doc/default.css
|
39
|
+
- doc/api.api
|
40
|
+
- doc/api.template
|
41
|
+
- doc/default.scss
|
33
42
|
- doc/default.template
|
34
|
-
- doc/
|
43
|
+
- doc/images/bg01.png
|
44
|
+
- doc/images/bg02.png
|
35
45
|
- doc/index.page
|
36
|
-
- doc/
|
46
|
+
- doc/installation.page
|
47
|
+
- doc/metainfo
|
48
|
+
- doc/news.page
|
37
49
|
- doc/tutorial.page
|
38
50
|
- doc/virtual
|
39
|
-
-
|
51
|
+
- example/net.rb
|
52
|
+
- lib/cmdparse.rb
|
53
|
+
- setup.rb
|
54
|
+
- webgen.config
|
40
55
|
homepage: http://cmdparse.gettalong.org
|
41
56
|
licenses:
|
42
|
-
-
|
57
|
+
- MIT
|
43
58
|
metadata: {}
|
44
59
|
post_install_message:
|
45
60
|
rdoc_options:
|
46
|
-
- --line-numbers
|
47
|
-
- --main
|
61
|
+
- "--line-numbers"
|
62
|
+
- "--main"
|
48
63
|
- CmdParse::CommandParser
|
49
64
|
require_paths:
|
50
65
|
- lib
|
51
66
|
required_ruby_version: !ruby/object:Gem::Requirement
|
52
67
|
requirements:
|
53
|
-
- -
|
68
|
+
- - ">="
|
54
69
|
- !ruby/object:Gem::Version
|
55
|
-
version:
|
70
|
+
version: 2.0.0
|
56
71
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
57
72
|
requirements:
|
58
|
-
- -
|
73
|
+
- - ">="
|
59
74
|
- !ruby/object:Gem::Version
|
60
75
|
version: '0'
|
61
76
|
requirements: []
|
62
77
|
rubyforge_project:
|
63
|
-
rubygems_version: 2.
|
78
|
+
rubygems_version: 2.4.5
|
64
79
|
signing_key:
|
65
80
|
specification_version: 4
|
66
81
|
summary: Advanced command line parser supporting commands
|
data/COPYING.LESSER
DELETED
@@ -1,165 +0,0 @@
|
|
1
|
-
GNU LESSER GENERAL PUBLIC LICENSE
|
2
|
-
Version 3, 29 June 2007
|
3
|
-
|
4
|
-
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
5
|
-
Everyone is permitted to copy and distribute verbatim copies
|
6
|
-
of this license document, but changing it is not allowed.
|
7
|
-
|
8
|
-
|
9
|
-
This version of the GNU Lesser General Public License incorporates
|
10
|
-
the terms and conditions of version 3 of the GNU General Public
|
11
|
-
License, supplemented by the additional permissions listed below.
|
12
|
-
|
13
|
-
0. Additional Definitions.
|
14
|
-
|
15
|
-
As used herein, "this License" refers to version 3 of the GNU Lesser
|
16
|
-
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
17
|
-
General Public License.
|
18
|
-
|
19
|
-
"The Library" refers to a covered work governed by this License,
|
20
|
-
other than an Application or a Combined Work as defined below.
|
21
|
-
|
22
|
-
An "Application" is any work that makes use of an interface provided
|
23
|
-
by the Library, but which is not otherwise based on the Library.
|
24
|
-
Defining a subclass of a class defined by the Library is deemed a mode
|
25
|
-
of using an interface provided by the Library.
|
26
|
-
|
27
|
-
A "Combined Work" is a work produced by combining or linking an
|
28
|
-
Application with the Library. The particular version of the Library
|
29
|
-
with which the Combined Work was made is also called the "Linked
|
30
|
-
Version".
|
31
|
-
|
32
|
-
The "Minimal Corresponding Source" for a Combined Work means the
|
33
|
-
Corresponding Source for the Combined Work, excluding any source code
|
34
|
-
for portions of the Combined Work that, considered in isolation, are
|
35
|
-
based on the Application, and not on the Linked Version.
|
36
|
-
|
37
|
-
The "Corresponding Application Code" for a Combined Work means the
|
38
|
-
object code and/or source code for the Application, including any data
|
39
|
-
and utility programs needed for reproducing the Combined Work from the
|
40
|
-
Application, but excluding the System Libraries of the Combined Work.
|
41
|
-
|
42
|
-
1. Exception to Section 3 of the GNU GPL.
|
43
|
-
|
44
|
-
You may convey a covered work under sections 3 and 4 of this License
|
45
|
-
without being bound by section 3 of the GNU GPL.
|
46
|
-
|
47
|
-
2. Conveying Modified Versions.
|
48
|
-
|
49
|
-
If you modify a copy of the Library, and, in your modifications, a
|
50
|
-
facility refers to a function or data to be supplied by an Application
|
51
|
-
that uses the facility (other than as an argument passed when the
|
52
|
-
facility is invoked), then you may convey a copy of the modified
|
53
|
-
version:
|
54
|
-
|
55
|
-
a) under this License, provided that you make a good faith effort to
|
56
|
-
ensure that, in the event an Application does not supply the
|
57
|
-
function or data, the facility still operates, and performs
|
58
|
-
whatever part of its purpose remains meaningful, or
|
59
|
-
|
60
|
-
b) under the GNU GPL, with none of the additional permissions of
|
61
|
-
this License applicable to that copy.
|
62
|
-
|
63
|
-
3. Object Code Incorporating Material from Library Header Files.
|
64
|
-
|
65
|
-
The object code form of an Application may incorporate material from
|
66
|
-
a header file that is part of the Library. You may convey such object
|
67
|
-
code under terms of your choice, provided that, if the incorporated
|
68
|
-
material is not limited to numerical parameters, data structure
|
69
|
-
layouts and accessors, or small macros, inline functions and templates
|
70
|
-
(ten or fewer lines in length), you do both of the following:
|
71
|
-
|
72
|
-
a) Give prominent notice with each copy of the object code that the
|
73
|
-
Library is used in it and that the Library and its use are
|
74
|
-
covered by this License.
|
75
|
-
|
76
|
-
b) Accompany the object code with a copy of the GNU GPL and this license
|
77
|
-
document.
|
78
|
-
|
79
|
-
4. Combined Works.
|
80
|
-
|
81
|
-
You may convey a Combined Work under terms of your choice that,
|
82
|
-
taken together, effectively do not restrict modification of the
|
83
|
-
portions of the Library contained in the Combined Work and reverse
|
84
|
-
engineering for debugging such modifications, if you also do each of
|
85
|
-
the following:
|
86
|
-
|
87
|
-
a) Give prominent notice with each copy of the Combined Work that
|
88
|
-
the Library is used in it and that the Library and its use are
|
89
|
-
covered by this License.
|
90
|
-
|
91
|
-
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
92
|
-
document.
|
93
|
-
|
94
|
-
c) For a Combined Work that displays copyright notices during
|
95
|
-
execution, include the copyright notice for the Library among
|
96
|
-
these notices, as well as a reference directing the user to the
|
97
|
-
copies of the GNU GPL and this license document.
|
98
|
-
|
99
|
-
d) Do one of the following:
|
100
|
-
|
101
|
-
0) Convey the Minimal Corresponding Source under the terms of this
|
102
|
-
License, and the Corresponding Application Code in a form
|
103
|
-
suitable for, and under terms that permit, the user to
|
104
|
-
recombine or relink the Application with a modified version of
|
105
|
-
the Linked Version to produce a modified Combined Work, in the
|
106
|
-
manner specified by section 6 of the GNU GPL for conveying
|
107
|
-
Corresponding Source.
|
108
|
-
|
109
|
-
1) Use a suitable shared library mechanism for linking with the
|
110
|
-
Library. A suitable mechanism is one that (a) uses at run time
|
111
|
-
a copy of the Library already present on the user's computer
|
112
|
-
system, and (b) will operate properly with a modified version
|
113
|
-
of the Library that is interface-compatible with the Linked
|
114
|
-
Version.
|
115
|
-
|
116
|
-
e) Provide Installation Information, but only if you would otherwise
|
117
|
-
be required to provide such information under section 6 of the
|
118
|
-
GNU GPL, and only to the extent that such information is
|
119
|
-
necessary to install and execute a modified version of the
|
120
|
-
Combined Work produced by recombining or relinking the
|
121
|
-
Application with a modified version of the Linked Version. (If
|
122
|
-
you use option 4d0, the Installation Information must accompany
|
123
|
-
the Minimal Corresponding Source and Corresponding Application
|
124
|
-
Code. If you use option 4d1, you must provide the Installation
|
125
|
-
Information in the manner specified by section 6 of the GNU GPL
|
126
|
-
for conveying Corresponding Source.)
|
127
|
-
|
128
|
-
5. Combined Libraries.
|
129
|
-
|
130
|
-
You may place library facilities that are a work based on the
|
131
|
-
Library side by side in a single library together with other library
|
132
|
-
facilities that are not Applications and are not covered by this
|
133
|
-
License, and convey such a combined library under terms of your
|
134
|
-
choice, if you do both of the following:
|
135
|
-
|
136
|
-
a) Accompany the combined library with a copy of the same work based
|
137
|
-
on the Library, uncombined with any other library facilities,
|
138
|
-
conveyed under the terms of this License.
|
139
|
-
|
140
|
-
b) Give prominent notice with the combined library that part of it
|
141
|
-
is a work based on the Library, and explaining where to find the
|
142
|
-
accompanying uncombined form of the same work.
|
143
|
-
|
144
|
-
6. Revised Versions of the GNU Lesser General Public License.
|
145
|
-
|
146
|
-
The Free Software Foundation may publish revised and/or new versions
|
147
|
-
of the GNU Lesser General Public License from time to time. Such new
|
148
|
-
versions will be similar in spirit to the present version, but may
|
149
|
-
differ in detail to address new problems or concerns.
|
150
|
-
|
151
|
-
Each version is given a distinguishing version number. If the
|
152
|
-
Library as you received it specifies that a certain numbered version
|
153
|
-
of the GNU Lesser General Public License "or any later version"
|
154
|
-
applies to it, you have the option of following the terms and
|
155
|
-
conditions either of that published version or of any later version
|
156
|
-
published by the Free Software Foundation. If the Library as you
|
157
|
-
received it does not specify a version number of the GNU Lesser
|
158
|
-
General Public License, you may choose any version of the GNU Lesser
|
159
|
-
General Public License ever published by the Free Software Foundation.
|
160
|
-
|
161
|
-
If the Library as you received it specifies that a proxy can decide
|
162
|
-
whether future versions of the GNU Lesser General Public License shall
|
163
|
-
apply, that proxy's public statement of acceptance of any version is
|
164
|
-
permanent authorization for you to choose that version for the
|
165
|
-
Library.
|
data/doc/about.page
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
---
|
2
|
-
title: About
|
3
|
-
in_menu: true
|
4
|
-
sort_info: 2
|
5
|
-
---
|
6
|
-
## About `cmdparse`
|
7
|
-
|
8
|
-
Some new programs use a "command style" command line. Examples for such programs are the "svn"
|
9
|
-
program from Subversion and the "gem" program from Rubygems. The standard Ruby distribution has no
|
10
|
-
library to create programs that use such a command line interface.
|
11
|
-
|
12
|
-
This library, cmdparse, can be used to create such a command line interface. Internally it uses
|
13
|
-
optparse or any other option parser library to parse options and it provides a nice API for
|
14
|
-
specifying commands and subcommands.
|
15
|
-
|
16
|
-
A typical command line for a program which uses commands looks like this:
|
17
|
-
|
18
|
-
$ net --verbose ipaddr add 192.168.0.1 193.150.0.1
|
19
|
-
|
20
|
-
## Author
|
21
|
-
|
22
|
-
* **Thomas Leitner**
|
23
|
-
* Web: <http://cmdparse.gettalong.org>
|
24
|
-
* e-Mail: <mailto:t_leitner@gmx.at>
|
data/doc/default.css
DELETED
@@ -1,152 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
#5CB85C -> background
|
3
|
-
#408040 -> headings
|
4
|
-
#CFE6CF -> code
|
5
|
-
#30BF30 -> other
|
6
|
-
*/
|
7
|
-
|
8
|
-
body {
|
9
|
-
margin: 0px 2em;
|
10
|
-
font-size: 12px;
|
11
|
-
font-family: Verdana, Arial, Helvetica;
|
12
|
-
border: 1px solid black;
|
13
|
-
color: black;
|
14
|
-
}
|
15
|
-
|
16
|
-
h1, h2, h3, h4, h5 { color: #408040}
|
17
|
-
|
18
|
-
a:visited { color: #408040; }
|
19
|
-
a { color: #5CB85C; }
|
20
|
-
.bar a { color: white }
|
21
|
-
.bar a:visited { color: white }
|
22
|
-
|
23
|
-
#all { background-color: #CFE6CF; }
|
24
|
-
|
25
|
-
#header {
|
26
|
-
border-bottom: 1px solid black;
|
27
|
-
padding: 1ex;
|
28
|
-
background-color: #5CB85C;
|
29
|
-
}
|
30
|
-
#header img {
|
31
|
-
padding-right: 5em;
|
32
|
-
}
|
33
|
-
#header h1 {
|
34
|
-
margin: 0ex;
|
35
|
-
font-size: 300%;
|
36
|
-
font-style: italic;
|
37
|
-
font-weight: normal;
|
38
|
-
color: white;
|
39
|
-
}
|
40
|
-
|
41
|
-
, #headerbar { border-bottom: 1px solid black; }
|
42
|
-
#footer { border-top: 1px solid black; }
|
43
|
-
|
44
|
-
#body {
|
45
|
-
margin-left: 250px;
|
46
|
-
margin-right: 20px;
|
47
|
-
padding: 10px;
|
48
|
-
}
|
49
|
-
|
50
|
-
#menu {
|
51
|
-
float: left;
|
52
|
-
width: 230px;
|
53
|
-
padding: 20px 0px 0px 2px;
|
54
|
-
}
|
55
|
-
|
56
|
-
.bar {
|
57
|
-
clear: both;
|
58
|
-
padding: 3px;
|
59
|
-
text-align: center;
|
60
|
-
font-size: 90%;
|
61
|
-
background-color: #30BF30;
|
62
|
-
}
|
63
|
-
|
64
|
-
.left, .right {
|
65
|
-
padding: 0px 1em;
|
66
|
-
}
|
67
|
-
|
68
|
-
.left {
|
69
|
-
float: left;
|
70
|
-
text-align: left;
|
71
|
-
}
|
72
|
-
|
73
|
-
.right {
|
74
|
-
float: right;
|
75
|
-
text-align: right;
|
76
|
-
}
|
77
|
-
|
78
|
-
/* styling the menu */
|
79
|
-
|
80
|
-
#menu a {
|
81
|
-
text-decoration: none;
|
82
|
-
font-weight: bold;
|
83
|
-
font-size: 130%;
|
84
|
-
}
|
85
|
-
|
86
|
-
#menu a:hover {
|
87
|
-
text-decoration: underline;
|
88
|
-
}
|
89
|
-
|
90
|
-
#menu .webgen-menuitem-selected {
|
91
|
-
border-left: 3px solid #408040;
|
92
|
-
}
|
93
|
-
|
94
|
-
#menu ul {
|
95
|
-
list-style-type: none;
|
96
|
-
padding: 0px;
|
97
|
-
margin-left: 10px;
|
98
|
-
}
|
99
|
-
|
100
|
-
#menu li > ul {
|
101
|
-
font-size: 95%;
|
102
|
-
}
|
103
|
-
|
104
|
-
#menu li {
|
105
|
-
margin: 0.0em 0px;
|
106
|
-
padding: 2px 0px;
|
107
|
-
padding-left: 5px;
|
108
|
-
border-left: 3px solid #CCCCCC;
|
109
|
-
}
|
110
|
-
|
111
|
-
/* styling the content */
|
112
|
-
|
113
|
-
h2 {
|
114
|
-
padding: 0px;
|
115
|
-
letter-spacing: 0.2em;
|
116
|
-
font-size: 150%;
|
117
|
-
font-weight: bold;
|
118
|
-
border-bottom: 1px solid #408040;
|
119
|
-
}
|
120
|
-
|
121
|
-
.webgen-file {
|
122
|
-
padding-left: 10px;
|
123
|
-
margin: 0px 10px;
|
124
|
-
border-left: 3px solid #5CB85C;
|
125
|
-
}
|
126
|
-
|
127
|
-
.webgen-picture {
|
128
|
-
text-align: center;
|
129
|
-
}
|
130
|
-
|
131
|
-
.webgen-picture img {
|
132
|
-
border: 1px solid black;
|
133
|
-
}
|
134
|
-
|
135
|
-
.webgen-gallery {
|
136
|
-
text-align: center;
|
137
|
-
}
|
138
|
-
|
139
|
-
.webgen-gallery table {
|
140
|
-
width: 100%;
|
141
|
-
}
|
142
|
-
|
143
|
-
.webgen-gallery table td{
|
144
|
-
text-align: center;
|
145
|
-
border: 1px solid black;
|
146
|
-
}
|
147
|
-
|
148
|
-
table.cmdparse-example td, pre {
|
149
|
-
border: 1px solid #408040;
|
150
|
-
background-color: white;
|
151
|
-
padding: 5px;
|
152
|
-
}
|