binman 3.3.3 → 3.4.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
  SHA1:
3
- metadata.gz: 25bbee995392523cf64aadd135db92cd22ade470
4
- data.tar.gz: 343bb4ab6fb0e9856b6a06b9d829a026287b84e8
3
+ metadata.gz: 727b7b3c6721e902b36563fd5330fe05fa5707a9
4
+ data.tar.gz: 94d7d927939cb06625b4423f8358370b8a69e8aa
5
5
  SHA512:
6
- metadata.gz: 4492b09a30bab9b6b608a691720b554a4c9af34bc2d77c502da19a264b3f4ff80628284417cd932c96e4f3082d5b351aeff0708add2a662c9738f1a0df3680ba
7
- data.tar.gz: baf68d5e678bd5e90057976f97cdb865f67e58df4c8471161b611d2f291e9d1db389bb4745bf56cd6f3b357b0e9774eb52f7e321f9358d876a7fbf113ab25bcc
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
- * Package: <https://rubygems.org/gems/binman>
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 130 lines of pure Ruby code! :-)
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
- gem install binman
33
+ ```sh
34
+ gem install binman
35
+ ```
34
36
 
35
37
  If you also want to build your own manual pages:
36
38
 
37
- gem install md2man -v '~> 3.0'
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
- git clone git://github.com/sunaku/binman
46
- cd binman
47
- bundle install
48
- bundle exec binman --help # run it directly
49
- bundle exec rake --tasks # packaging tasks
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
- binman --help
63
+ ```sh
64
+ binman --help
65
+ ```
58
66
 
59
67
  ### Inside a Ruby script
60
68
 
61
- #!/usr/bin/env ruby
62
- # your program's manual page goes here
69
+ ```ruby
70
+ #!/usr/bin/env ruby
71
+ # your program's manual page goes here
63
72
 
64
- require 'binman'
73
+ require 'binman'
65
74
 
66
- # OPTION 1: show manual and exit if ARGV has -h or --help except after --
67
- BinMan.help
75
+ # OPTION 1: show manual and exit if ARGV has -h or --help except after --
76
+ BinMan.help
68
77
 
69
- # OPTION 2: show manual unconditionally
70
- BinMan.show
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
- #!/usr/bin/env ruby
75
- # -*- coding: utf-8 -*-
76
- # your program's manual page goes here
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
- #!/usr/bin/env ruby
81
- =begin
82
- your program's manual page goes here
83
- =end
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
- #!/usr/bin/env ruby
88
- # -*- coding: utf-8 -*-
89
- =begin
90
- your program's manual page goes here
91
- =end
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
- #!/usr/bin/sh
98
- # your program's manual page goes here
113
+ ```ruby
114
+ #!/usr/bin/sh
115
+ # your program's manual page goes here
99
116
 
100
- # OPTION 1: show manual and exit if ARGV has -h or --help except after --
101
- binman help "$0" "$@" && exit
117
+ # OPTION 1: show manual and exit if ARGV has -h or --help except after --
118
+ binman help "$0" "$@" && exit
102
119
 
103
- # OPTION 2: show manual unconditionally
104
- binman show "$0"
120
+ # OPTION 2: show manual unconditionally
121
+ binman show "$0"
122
+ ```
105
123
 
106
124
  ### Inside a Perl script
107
125
 
108
- #!/usr/bin/env perl
109
- # your program's manual page goes here
126
+ ```perl
127
+ #!/usr/bin/env perl
128
+ # your program's manual page goes here
110
129
 
111
- # OPTION 1: show manual and exit if ARGV has -h or --help except after --
112
- system('binman', 'help', __FILE__, @ARGV) == 0 and exit;
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
- # OPTION 2: show manual unconditionally
115
- system('binman', 'show', __FILE__);
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
- #!/usr/bin/env perl
120
- print "your program's code goes here";
121
- __END__
122
- =begin
123
- your program's manual page goes here
124
- =end
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
- #!/usr/bin/env python
129
- # your program's manual page goes here
150
+ ```python
151
+ #!/usr/bin/env python
152
+ # your program's manual page goes here
130
153
 
131
- import sys, subprocess
154
+ import sys, subprocess
132
155
 
133
- # OPTION 1: show manual and exit if ARGV has -h or --help except after --
134
- subprocess.call(['binman', 'help', __file__] + sys.argv) == 0 and sys.exit()
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
- # OPTION 2: show manual unconditionally
137
- subprocess.call(['binman', 'show', __file__])
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
- #!/usr/bin/env python
142
- # -*- coding: utf-8 -*-
143
- # your program's manual page goes here
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
- #!/usr/bin/env python
148
- """
149
- =begin
150
- your program's manual page goes here
151
- =end
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
- #!/usr/bin/env python
157
- # -*- coding: utf-8 -*-
158
- """
159
- =begin
160
- your program's manual page goes here
161
- =end
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
- #!/usr/bin/awk -f
171
- # your program's manual page goes here
200
+ ```awk
201
+ #!/usr/bin/awk -f
202
+ # your program's manual page goes here
172
203
 
173
- # OPTION 1: show manual and exit if ARGV has -h or --help except after --
174
- BEGIN {getline c <"/proc/self/cmdline"; sub(".*-f\0"," ",c); gsub("\0"," ",c);
175
- if(system("binman help" c) == 0){ exit }}
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
- # OPTION 2: show manual unconditionally
178
- BEGIN {getline c <"/proc/self/cmdline"; sub(".*-f\0"," ",c); sub("\0.*","",c);
179
- system("binman show" c)}
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
- #!/usr/bin/env tclsh
184
- # your program's manual page goes here
215
+ ```tcl
216
+ #!/usr/bin/env tclsh
217
+ # your program's manual page goes here
185
218
 
186
- # OPTION 1: show manual and exit if ARGV has -h or --help except after --
187
- if {![catch {exec -- >/dev/tty binman help $argv0 {*}$argv}]} {exit}
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
- # OPTION 2: show manual unconditionally
190
- exec >/dev/tty binman show $argv0
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
- #!/usr/bin/env tclsh
195
- if 0 {
196
- =begin
197
- your program's manual page goes here
198
- =end
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
- =begin
205
- your program's manual page goes here
206
- =end
207
- */
239
+ ```javascript
240
+ /*
241
+ =begin
242
+ your program's manual page goes here
243
+ =end
244
+ */
208
245
 
209
- var exec = require('child_process').exec;
246
+ var exec = require('child_process').exec;
210
247
 
211
- // OPTION 1: show manual and exit if ARGV has -h or --help except after --
212
- exec(['>/dev/tty', 'binman', 'help', __filename].concat(process.argv).
213
- join(' '), function(error){ if (error === null){ process.exit(); } });
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
- // OPTION 2: show manual unconditionally
216
- exec(['>/dev/tty', 'binman', 'show', __filename].join(' '));
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
- binman-rake --help
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
- s.files += Dir['man/man?/*.?'] # UNIX man pages
233
- s.files += Dir['man/**/*.{html,css,js}'] # HTML man pages
234
- s.add_development_dependency 'md2man', '~> 3.0'
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
- require 'binman/rakefile'
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
- bundle exec rake build
249
- gem spec pkg/*.gem | fgrep man/man
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-22 3.3.3
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* [*ARGUMENT*]...
68
- If the given *ARGUMENT* sequence contains `-h` or `--help` except after
69
- `--`, then this program extracts the given *FILE*'s leading comment header,
70
- converts it into roff(7), and displays it using man(1) before exiting with
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.