binman 3.3.3 → 3.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.markdown +155 -109
- data/VERSION.markdown +15 -0
- data/bin/binman +10 -7
- data/bin/binman-rake +1 -1
- data/lib/binman.rb +32 -8
- data/lib/binman/version.rb +1 -1
- data/man/man0/README.html +26 -26
- data/man/man0/README.markdown +155 -109
- data/man/man0/VERSION.html +12 -1
- data/man/man0/VERSION.markdown +15 -0
- data/man/man1/binman-rake.1 +1 -1
- data/man/man1/binman-rake.1.html +1 -1
- data/man/man1/binman.1 +14 -9
- data/man/man1/binman.1.html +9 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 727b7b3c6721e902b36563fd5330fe05fa5707a9
|
4
|
+
data.tar.gz: 94d7d927939cb06625b4423f8358370b8a69e8aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 96478840dc759fb9b9f62083ab9656a433d20c19be07fece5f3f4f62e55d05fa7d877fe49faddc00ba42fda7b25be693bc3404a56fcb0e84db8041a5b19d2e7b
|
7
|
+
data.tar.gz: a987be972eabdcb0521ae9ba85ccd9172f4cbdfe8e72cbf7d92c300a82ab33b9c659c5b8a4d293af3214f3de39571f3a7c97baf42556f139482aa95a62b9a0ed
|
data/README.markdown
CHANGED
@@ -2,10 +2,10 @@
|
|
2
2
|
|
3
3
|
[binman] produces UNIX manual pages for executable scripts using [md2man].
|
4
4
|
|
5
|
-
*
|
6
|
-
* Manuals: <https://sunaku.github.io/binman>
|
5
|
+
* Manuals: <https://sunaku.github.io/binman/man>
|
7
6
|
* Sources: <https://github.com/sunaku/binman>
|
8
7
|
* Support: <https://github.com/sunaku/binman/issues>
|
8
|
+
* Package: <https://rubygems.org/gems/binman>
|
9
9
|
|
10
10
|
## Features
|
11
11
|
|
@@ -17,7 +17,7 @@
|
|
17
17
|
|
18
18
|
* Individual extraction, conversion, and display commands.
|
19
19
|
|
20
|
-
* Implemented in roughly
|
20
|
+
* Implemented in roughly 150 lines of pure Ruby code! :-)
|
21
21
|
|
22
22
|
### Demonstration
|
23
23
|
|
@@ -30,11 +30,15 @@ For examples in other scripting languages, see the "Usage" section below!
|
|
30
30
|
|
31
31
|
If you only want to view pre-built manual pages:
|
32
32
|
|
33
|
-
|
33
|
+
```sh
|
34
|
+
gem install binman
|
35
|
+
```
|
34
36
|
|
35
37
|
If you also want to build your own manual pages:
|
36
38
|
|
37
|
-
|
39
|
+
```sh
|
40
|
+
gem install md2man -v '~> 3.0'
|
41
|
+
```
|
38
42
|
|
39
43
|
### Prerequisites
|
40
44
|
|
@@ -42,11 +46,13 @@ If you also want to build your own manual pages:
|
|
42
46
|
|
43
47
|
### Development
|
44
48
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
49
|
+
```sh
|
50
|
+
git clone git://github.com/sunaku/binman
|
51
|
+
cd binman
|
52
|
+
bundle install
|
53
|
+
bundle exec binman --help # run it directly
|
54
|
+
bundle exec rake --tasks # packaging tasks
|
55
|
+
```
|
50
56
|
|
51
57
|
## Usage
|
52
58
|
|
@@ -54,112 +60,136 @@ If you also want to build your own manual pages:
|
|
54
60
|
|
55
61
|
See binman(1) manual:
|
56
62
|
|
57
|
-
|
63
|
+
```sh
|
64
|
+
binman --help
|
65
|
+
```
|
58
66
|
|
59
67
|
### Inside a Ruby script
|
60
68
|
|
61
|
-
|
62
|
-
|
69
|
+
```ruby
|
70
|
+
#!/usr/bin/env ruby
|
71
|
+
# your program's manual page goes here
|
63
72
|
|
64
|
-
|
73
|
+
require 'binman'
|
65
74
|
|
66
|
-
|
67
|
-
|
75
|
+
# OPTION 1: show manual and exit if ARGV has -h or --help except after --
|
76
|
+
BinMan.help
|
68
77
|
|
69
|
-
|
70
|
-
|
78
|
+
# OPTION 2: show manual unconditionally
|
79
|
+
BinMan.show
|
80
|
+
```
|
71
81
|
|
72
82
|
You can also specify your program's source file encoding above the manual:
|
73
83
|
|
74
|
-
|
75
|
-
|
76
|
-
|
84
|
+
```ruby
|
85
|
+
#!/usr/bin/env ruby
|
86
|
+
# -*- coding: utf-8 -*-
|
87
|
+
# your program's manual page goes here
|
88
|
+
```
|
77
89
|
|
78
90
|
You can also write the manual as a multi-line Ruby comment:
|
79
91
|
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
92
|
+
```ruby
|
93
|
+
#!/usr/bin/env ruby
|
94
|
+
=begin
|
95
|
+
your program's manual page goes here
|
96
|
+
=end
|
97
|
+
```
|
84
98
|
|
85
99
|
You can also specify your program's source file encoding above the manual:
|
86
100
|
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
101
|
+
```ruby
|
102
|
+
#!/usr/bin/env ruby
|
103
|
+
# -*- coding: utf-8 -*-
|
104
|
+
=begin
|
105
|
+
your program's manual page goes here
|
106
|
+
=end
|
107
|
+
```
|
92
108
|
|
93
109
|
See the [API documentation][binman-api] for even more possibilities!
|
94
110
|
|
95
111
|
### Inside a shell script
|
96
112
|
|
97
|
-
|
98
|
-
|
113
|
+
```ruby
|
114
|
+
#!/usr/bin/sh
|
115
|
+
# your program's manual page goes here
|
99
116
|
|
100
|
-
|
101
|
-
|
117
|
+
# OPTION 1: show manual and exit if ARGV has -h or --help except after --
|
118
|
+
binman help "$0" "$@" && exit
|
102
119
|
|
103
|
-
|
104
|
-
|
120
|
+
# OPTION 2: show manual unconditionally
|
121
|
+
binman show "$0"
|
122
|
+
```
|
105
123
|
|
106
124
|
### Inside a Perl script
|
107
125
|
|
108
|
-
|
109
|
-
|
126
|
+
```perl
|
127
|
+
#!/usr/bin/env perl
|
128
|
+
# your program's manual page goes here
|
110
129
|
|
111
|
-
|
112
|
-
|
130
|
+
# OPTION 1: show manual and exit if ARGV has -h or --help except after --
|
131
|
+
system('binman', 'help', __FILE__, @ARGV) == 0 and exit;
|
113
132
|
|
114
|
-
|
115
|
-
|
133
|
+
# OPTION 2: show manual unconditionally
|
134
|
+
system('binman', 'show', __FILE__);
|
135
|
+
```
|
116
136
|
|
117
137
|
You can also write the manual as a multi-line Ruby comment after `__END__`:
|
118
138
|
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
139
|
+
```perl
|
140
|
+
#!/usr/bin/env perl
|
141
|
+
print "your program's code goes here";
|
142
|
+
__END__
|
143
|
+
=begin
|
144
|
+
your program's manual page goes here
|
145
|
+
=end
|
146
|
+
```
|
125
147
|
|
126
148
|
### Inside a Python script
|
127
149
|
|
128
|
-
|
129
|
-
|
150
|
+
```python
|
151
|
+
#!/usr/bin/env python
|
152
|
+
# your program's manual page goes here
|
130
153
|
|
131
|
-
|
154
|
+
import sys, subprocess
|
132
155
|
|
133
|
-
|
134
|
-
|
156
|
+
# OPTION 1: show manual and exit if ARGV has -h or --help except after --
|
157
|
+
subprocess.call(['binman', 'help', __file__] + sys.argv) == 0 and sys.exit()
|
135
158
|
|
136
|
-
|
137
|
-
|
159
|
+
# OPTION 2: show manual unconditionally
|
160
|
+
subprocess.call(['binman', 'show', __file__])
|
161
|
+
```
|
138
162
|
|
139
163
|
You can also specify your program's source file encoding above the manual:
|
140
164
|
|
141
|
-
|
142
|
-
|
143
|
-
|
165
|
+
```python
|
166
|
+
#!/usr/bin/env python
|
167
|
+
# -*- coding: utf-8 -*-
|
168
|
+
# your program's manual page goes here
|
169
|
+
```
|
144
170
|
|
145
171
|
You can also write the manual as a multi-line Ruby comment inside a docstring:
|
146
172
|
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
173
|
+
```python
|
174
|
+
#!/usr/bin/env python
|
175
|
+
"""
|
176
|
+
=begin
|
177
|
+
your program's manual page goes here
|
178
|
+
=end
|
179
|
+
"""
|
180
|
+
```
|
153
181
|
|
154
182
|
You can also specify your program's source file encoding above the manual:
|
155
183
|
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
184
|
+
```python
|
185
|
+
#!/usr/bin/env python
|
186
|
+
# -*- coding: utf-8 -*-
|
187
|
+
"""
|
188
|
+
=begin
|
189
|
+
your program's manual page goes here
|
190
|
+
=end
|
191
|
+
"""
|
192
|
+
```
|
163
193
|
|
164
194
|
### Inside an AWK script
|
165
195
|
|
@@ -167,53 +197,61 @@ The technique for determining current AWK script file name [comes from here](
|
|
167
197
|
http://www.mombu.com/programming/programming/t-the-name-of-script-itself-2040784-print.html
|
168
198
|
).
|
169
199
|
|
170
|
-
|
171
|
-
|
200
|
+
```awk
|
201
|
+
#!/usr/bin/awk -f
|
202
|
+
# your program's manual page goes here
|
172
203
|
|
173
|
-
|
174
|
-
|
175
|
-
|
204
|
+
# OPTION 1: show manual and exit if ARGV has -h or --help except after --
|
205
|
+
BEGIN {getline c <"/proc/self/cmdline"; sub(".*-f\0"," ",c); gsub("\0"," ",c);
|
206
|
+
if(system("binman help" c) == 0){ exit }}
|
176
207
|
|
177
|
-
|
178
|
-
|
179
|
-
|
208
|
+
# OPTION 2: show manual unconditionally
|
209
|
+
BEGIN {getline c <"/proc/self/cmdline"; sub(".*-f\0"," ",c); sub("\0.*","",c);
|
210
|
+
system("binman show" c)}
|
211
|
+
```
|
180
212
|
|
181
213
|
### Inside a Tcl script
|
182
214
|
|
183
|
-
|
184
|
-
|
215
|
+
```tcl
|
216
|
+
#!/usr/bin/env tclsh
|
217
|
+
# your program's manual page goes here
|
185
218
|
|
186
|
-
|
187
|
-
|
219
|
+
# OPTION 1: show manual and exit if ARGV has -h or --help except after --
|
220
|
+
if {![catch {exec -- >/dev/tty binman help $argv0 {*}$argv}]} {exit}
|
188
221
|
|
189
|
-
|
190
|
-
|
222
|
+
# OPTION 2: show manual unconditionally
|
223
|
+
exec >/dev/tty binman show $argv0
|
224
|
+
```
|
191
225
|
|
192
226
|
You can also write the manual as a multi-line Ruby comment inside an `if 0`:
|
193
227
|
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
228
|
+
```tcl
|
229
|
+
#!/usr/bin/env tclsh
|
230
|
+
if 0 {
|
231
|
+
=begin
|
232
|
+
your program's manual page goes here
|
233
|
+
=end
|
234
|
+
}
|
235
|
+
```
|
200
236
|
|
201
237
|
### Inside a Node.js script
|
202
238
|
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
239
|
+
```javascript
|
240
|
+
/*
|
241
|
+
=begin
|
242
|
+
your program's manual page goes here
|
243
|
+
=end
|
244
|
+
*/
|
208
245
|
|
209
|
-
|
246
|
+
var exec = require('child_process').exec;
|
210
247
|
|
211
|
-
|
212
|
-
|
213
|
-
|
248
|
+
// OPTION 1: show manual and exit if ARGV has -h or --help except after --
|
249
|
+
exec(['>/dev/tty', 'binman', 'help', __filename].concat(process.argv).
|
250
|
+
join(' '), function(error){ if (error === null){ process.exit(); } });
|
214
251
|
|
215
|
-
|
216
|
-
|
252
|
+
// OPTION 2: show manual unconditionally
|
253
|
+
exec(['>/dev/tty', 'binman', 'show', __filename].join(' '));
|
254
|
+
```
|
217
255
|
|
218
256
|
## Packaging
|
219
257
|
|
@@ -223,19 +261,25 @@ You can also write the manual as a multi-line Ruby comment inside an `if 0`:
|
|
223
261
|
|
224
262
|
See binman-rake(1) manual:
|
225
263
|
|
226
|
-
|
264
|
+
```sh
|
265
|
+
binman-rake --help
|
266
|
+
```
|
227
267
|
|
228
268
|
#### Inside a Ruby script
|
229
269
|
|
230
270
|
Add this snippet to your gemspec file:
|
231
271
|
|
232
|
-
|
233
|
-
|
234
|
-
|
272
|
+
```ruby
|
273
|
+
s.files += Dir['man/man?/*.?'] # UNIX man pages
|
274
|
+
s.files += Dir['man/**/*.{html,css,js}'] # HTML man pages
|
275
|
+
s.add_development_dependency 'md2man', '~> 3.0'
|
276
|
+
```
|
235
277
|
|
236
278
|
Add the following line to your Rakefile:
|
237
279
|
|
238
|
-
|
280
|
+
```ruby
|
281
|
+
require 'binman/rakefile'
|
282
|
+
```
|
239
283
|
|
240
284
|
You now have a `rake binman` task that pre-builds UNIX manual page files for
|
241
285
|
your `bin/` scripts into a `man/` directory so that your end-users do not need
|
@@ -245,8 +289,10 @@ There are also sub-tasks to build manual pages individually as [roff] or HTML.
|
|
245
289
|
If you're using Bundler, this task also hooks into its gem packaging tasks and
|
246
290
|
ensures that your UNIX manual pages are pre-built and packaged into your gem:
|
247
291
|
|
248
|
-
|
249
|
-
|
292
|
+
```shell
|
293
|
+
bundle exec rake build
|
294
|
+
gem spec pkg/*.gem | fgrep man/man
|
295
|
+
```
|
250
296
|
|
251
297
|
## License
|
252
298
|
|
data/VERSION.markdown
CHANGED
@@ -1,3 +1,18 @@
|
|
1
|
+
## Version 3.4.0 (2014-06-29)
|
2
|
+
|
3
|
+
### Minor:
|
4
|
+
|
5
|
+
* GH-3: add optional regexp argument to `-h`/`--help` to search in man(1).
|
6
|
+
|
7
|
+
The `-h` and `--help` options in `BinMan.help()` can now be optionally
|
8
|
+
followed by a regular expression argument that specifies text to search
|
9
|
+
for and, if found, jump to inside the displayed UNIX man page. Such a
|
10
|
+
regular expression argument can now also be passed into `BinMan.show()`.
|
11
|
+
|
12
|
+
### Other:
|
13
|
+
|
14
|
+
* README: add syntax highlighting to code snippets.
|
15
|
+
|
1
16
|
## Version 3.3.3 (2014-06-22)
|
2
17
|
|
3
18
|
This release upgrades to md2man 3.0 for improved HTML manuals.
|
data/bin/binman
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
=begin =======================================================================
|
3
3
|
|
4
|
-
# BINMAN 1 2014-06-
|
4
|
+
# BINMAN 1 2014-06-29 3.4.0
|
5
5
|
|
6
6
|
## NAME
|
7
7
|
|
@@ -64,15 +64,18 @@ The following [Redcarpet] extensions are enabled while processing markdown(7):
|
|
64
64
|
|
65
65
|
## COMMANDS
|
66
66
|
|
67
|
-
`help` *FILE* [*
|
68
|
-
If the given
|
69
|
-
`--`,
|
70
|
-
|
67
|
+
`help` *FILE* ... [`-h`|`--help` [*REGEXP*]] ... [`--`] ...
|
68
|
+
If the given argument sequence contains `-h` or `--help`, except after
|
69
|
+
`--`, optionally followed by a *REGEXP* regular expression that specifies
|
70
|
+
text to search for and, if found, jump to inside the displayed man page,
|
71
|
+
then this program extracts the given *FILE*'s leading comment header,
|
72
|
+
converts it into roff(7), displays it using man(1), and finally exits with
|
71
73
|
status code `0`. Otherwise, this program exits with status code `111`.
|
72
74
|
|
73
|
-
`show` [*FILE*]
|
75
|
+
`show` [*FILE*] [*REGEXP*]
|
74
76
|
Use man(1) to display the roff(7) conversion of the leading comment header
|
75
|
-
extracted from the given *FILE* or STDIN.
|
77
|
+
extracted from the given *FILE* or STDIN. If *REGEXP* is given, search for
|
78
|
+
it within the output displayed by man(1) and jump to first match if found.
|
76
79
|
|
77
80
|
`load` [*FILE*]
|
78
81
|
Print the leading comment header extracted from the given *FILE* or STDIN.
|