binman 3.4.1 → 4.0.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 +70 -60
- data/VERSION.markdown +13 -0
- data/bin/binman +14 -18
- data/bin/binman-rake +1 -1
- data/binman.gemspec +1 -1
- data/lib/binman.rb +12 -19
- data/lib/binman/rakefile.rb +1 -3
- data/lib/binman/version.rb +1 -1
- data/man/index.html +1 -1
- data/man/man0/README.html +87 -104
- data/man/man0/README.markdown +70 -60
- data/man/man0/VERSION.html +14 -6
- data/man/man0/VERSION.markdown +13 -0
- data/man/man1/binman-rake.1 +1 -1
- data/man/man1/binman-rake.1.html +3 -4
- data/man/man1/binman.1 +23 -36
- data/man/man1/binman.1.html +7 -8
- data/man/style.css +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1cc5d7a68d2e6551e60382f9b64667e099ce762f
|
4
|
+
data.tar.gz: 2a8ecf5be7b27cc58f680c63ef8f90fc96a7088e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b96360d2329f069691839253409f0d261b72caceaa612762817938b056529a7e26fea03f8f830330ebf867252d7ca718b53cbb435820ab5108ad2422a93d27a
|
7
|
+
data.tar.gz: a332414eed9ce3a4f0e5d70ce83c8ca2169063052deff307f1778b42a9ed2923a76a0736d946be6b757f93633c485a474fe3d417acac99eb3f1658009d04de0c
|
data/README.markdown
CHANGED
@@ -4,9 +4,9 @@
|
|
4
4
|
Simply [document your script in Markdown][md2man-markdown] as a comment at the
|
5
5
|
top of your script and call `binman show` to display it as a UNIX manual page!
|
6
6
|
Or, call `binman help` to display your manual _only_ when your script receives
|
7
|
-
with `-h` or `--help` command-line options. Or, call `binman
|
7
|
+
with `-h` or `--help` command-line options. Or, call `binman snip` to extract
|
8
8
|
the manual from your script for your own custom processing, outside of binman.
|
9
|
-
And that's not all: [see the manual][binman-man] for
|
9
|
+
And that's not all: [see the manual page][binman-man] for more possibilities!
|
10
10
|
|
11
11
|
* Manuals: <https://sunaku.github.io/binman/man>
|
12
12
|
* Sources: <https://github.com/sunaku/binman>
|
@@ -29,62 +29,72 @@ And that's not all: [see the manual][binman-man] for even more possibilities!
|
|
29
29
|
|
30
30
|

|
31
31
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
[
|
38
|
-
|
39
|
-
[
|
40
|
-
|
41
|
-
[
|
42
|
-
|
43
|
-
[
|
44
|
-
|
45
|
-
[
|
46
|
-
|
47
|
-
[
|
48
|
-
|
49
|
-
[
|
50
|
-
|
51
|
-
[
|
52
|
-
|
53
|
-
[
|
54
|
-
|
55
|
-
[
|
56
|
-
|
57
|
-
[
|
58
|
-
|
59
|
-
[
|
60
|
-
|
61
|
-
[
|
62
|
-
|
63
|
-
[
|
64
|
-
|
65
|
-
[
|
66
|
-
|
67
|
-
[
|
68
|
-
|
69
|
-
[roff
|
70
|
-
|
71
|
-
[
|
72
|
-
|
73
|
-
[
|
74
|
-
|
75
|
-
[
|
76
|
-
|
77
|
-
[
|
78
|
-
|
79
|
-
[
|
80
|
-
|
81
|
-
[
|
82
|
-
|
83
|
-
[
|
84
|
-
|
85
|
-
[
|
86
|
-
|
87
|
-
|
32
|
+
#### What can binman(1) do?
|
33
|
+
|
34
|
+
Here are some real examples of processed bin scripts to help you get started:
|
35
|
+
|
36
|
+
* [bin/tork](https://raw.github.com/sunaku/tork/master/bin/tork) ⇒
|
37
|
+
[tork.1.markdown](https://sunaku.github.io/tork/man/man1/tork.1.markdown) ⇒
|
38
|
+
[tork.1](https://sunaku.github.io/tork/man/man1/tork.1) +
|
39
|
+
[tork.1.html](https://sunaku.github.io/tork/man/man1/tork.1.html)
|
40
|
+
* [bin/tork-runner](https://raw.github.com/sunaku/tork/master/bin/tork-runner) ⇒
|
41
|
+
[tork-runner.1.markdown](https://sunaku.github.io/tork/man/man1/tork-runner.1.markdown) ⇒
|
42
|
+
[tork-runner.1](https://sunaku.github.io/tork/man/man1/tork-runner.1) +
|
43
|
+
[tork-runner.1.html](https://sunaku.github.io/tork/man/man1/tork-runner.1.html)
|
44
|
+
* [bin/tork-herald](https://raw.github.com/sunaku/tork/master/bin/tork-herald) ⇒
|
45
|
+
[tork-herald.1.markdown](https://sunaku.github.io/tork/man/man1/tork-herald.1.markdown) ⇒
|
46
|
+
[tork-herald.1](https://sunaku.github.io/tork/man/man1/tork-herald.1) +
|
47
|
+
[tork-herald.1.html](https://sunaku.github.io/tork/man/man1/tork-herald.1.html)
|
48
|
+
* [bin/tork-driver](https://raw.github.com/sunaku/tork/master/bin/tork-driver) ⇒
|
49
|
+
[tork-driver.1.markdown](https://sunaku.github.io/tork/man/man1/tork-driver.1.markdown) ⇒
|
50
|
+
[tork-driver.1](https://sunaku.github.io/tork/man/man1/tork-driver.1) +
|
51
|
+
[tork-driver.1.html](https://sunaku.github.io/tork/man/man1/tork-driver.1.html)
|
52
|
+
* [bin/tork-engine](https://raw.github.com/sunaku/tork/master/bin/tork-engine) ⇒
|
53
|
+
[tork-engine.1.markdown](https://sunaku.github.io/tork/man/man1/tork-engine.1.markdown) ⇒
|
54
|
+
[tork-engine.1](https://sunaku.github.io/tork/man/man1/tork-engine.1) +
|
55
|
+
[tork-engine.1.html](https://sunaku.github.io/tork/man/man1/tork-engine.1.html)
|
56
|
+
* [bin/tork-master](https://raw.github.com/sunaku/tork/master/bin/tork-master) ⇒
|
57
|
+
[tork-master.1.markdown](https://sunaku.github.io/tork/man/man1/tork-master.1.markdown) ⇒
|
58
|
+
[tork-master.1](https://sunaku.github.io/tork/man/man1/tork-master.1) +
|
59
|
+
[tork-master.1.html](https://sunaku.github.io/tork/man/man1/tork-master.1.html)
|
60
|
+
* [bin/tork-remote](https://raw.github.com/sunaku/tork/master/bin/tork-remote) ⇒
|
61
|
+
[tork-remote.1.markdown](https://sunaku.github.io/tork/man/man1/tork-remote.1.markdown) ⇒
|
62
|
+
[tork-remote.1](https://sunaku.github.io/tork/man/man1/tork-remote.1) +
|
63
|
+
[tork-remote.1.html](https://sunaku.github.io/tork/man/man1/tork-remote.1.html)
|
64
|
+
* [bin/tork-notify](https://raw.github.com/sunaku/tork/master/bin/tork-notify) ⇒
|
65
|
+
[tork-notify.1.markdown](https://sunaku.github.io/tork/man/man1/tork-notify.1.markdown) ⇒
|
66
|
+
[tork-notify.1](https://sunaku.github.io/tork/man/man1/tork-notify.1) +
|
67
|
+
[tork-notify.1.html](https://sunaku.github.io/tork/man/man1/tork-notify.1.html)
|
68
|
+
* [bin/md2man-roff](https://raw.github.com/sunaku/md2man/master/bin/md2man-roff) ⇒
|
69
|
+
[md2man-roff.1.markdown](https://sunaku.github.io/md2man/man/man1/md2man-roff.1.markdown) ⇒
|
70
|
+
[md2man-roff.1](https://sunaku.github.io/md2man/man/man1/md2man-roff.1) +
|
71
|
+
[md2man-roff.1.html](https://sunaku.github.io/md2man/man/man1/md2man-roff.1.html)
|
72
|
+
* [bin/md2man-html](https://raw.github.com/sunaku/md2man/master/bin/md2man-html) ⇒
|
73
|
+
[md2man-html.1.markdown](https://sunaku.github.io/md2man/man/man1/md2man-html.1.markdown) ⇒
|
74
|
+
[md2man-html.1](https://sunaku.github.io/md2man/man/man1/md2man-html.1) +
|
75
|
+
[md2man-html.1.html](https://sunaku.github.io/md2man/man/man1/md2man-html.1.html)
|
76
|
+
* [bin/md2man-rake](https://raw.github.com/sunaku/md2man/master/bin/md2man-rake) ⇒
|
77
|
+
[md2man-rake.1.markdown](https://sunaku.github.io/md2man/man/man1/md2man-rake.1.markdown) ⇒
|
78
|
+
[md2man-rake.1](https://sunaku.github.io/md2man/man/man1/md2man-rake.1) +
|
79
|
+
[md2man-rake.1.html](https://sunaku.github.io/md2man/man/man1/md2man-rake.1.html)
|
80
|
+
* [bin/binman](https://raw.github.com/sunaku/binman/master/bin/binman) ⇒
|
81
|
+
[binman.1.markdown](https://sunaku.github.io/binman/man/man1/binman.1.markdown) ⇒
|
82
|
+
[binman.1](https://sunaku.github.io/binman/man/man1/binman.1) +
|
83
|
+
[binman.1.html](https://sunaku.github.io/binman/man/man1/binman.1.html)
|
84
|
+
* [bin/binman-rake](https://raw.github.com/sunaku/binman/master/bin/binman-rake) ⇒
|
85
|
+
[binman-rake.1.markdown](https://sunaku.github.io/binman/man/man1/binman-rake.1.markdown) ⇒
|
86
|
+
[binman-rake.1](https://sunaku.github.io/binman/man/man1/binman-rake.1) +
|
87
|
+
[binman-rake.1.html](https://sunaku.github.io/binman/man/man1/binman-rake.1.html)
|
88
|
+
|
89
|
+
For examples in even more scripting languages, see the "Usage" section below!
|
90
|
+
|
91
|
+
#### What can binman-rake(1) do?
|
92
|
+
|
93
|
+
Here are some examples of HTML manual _sets_ produced by binman-rake(1):
|
94
|
+
|
95
|
+
* https://sunaku.github.io/tork/man
|
96
|
+
* https://sunaku.github.io/binman/man
|
97
|
+
* https://sunaku.github.io/md2man/man
|
88
98
|
|
89
99
|
## Installation
|
90
100
|
|
@@ -97,7 +107,7 @@ gem install binman
|
|
97
107
|
If you also want to build your own manual pages:
|
98
108
|
|
99
109
|
```sh
|
100
|
-
gem install md2man -v '~>
|
110
|
+
gem install md2man -v '~> 4.0'
|
101
111
|
```
|
102
112
|
|
103
113
|
### Prerequisites
|
@@ -332,7 +342,7 @@ Add this snippet to your gemspec file:
|
|
332
342
|
```ruby
|
333
343
|
s.files += Dir['man/man?/*.?'] # UNIX man pages
|
334
344
|
s.files += Dir['man/**/*.{html,css,js}'] # HTML man pages
|
335
|
-
s.add_development_dependency 'md2man', '~>
|
345
|
+
s.add_development_dependency 'md2man', '~> 4.0'
|
336
346
|
```
|
337
347
|
|
338
348
|
Add the following line to your Rakefile:
|
data/VERSION.markdown
CHANGED
@@ -1,3 +1,16 @@
|
|
1
|
+
## Version 4.0.0 (2014-10-26)
|
2
|
+
|
3
|
+
### Major:
|
4
|
+
|
5
|
+
* binman(1): Rename the `load` command to `snip` and remove `conv`.
|
6
|
+
|
7
|
+
* The `binman conv` command has been removed; use `md2man-roff` instead.
|
8
|
+
|
9
|
+
* We no longer require a specific md2man version at runtime; any will do.
|
10
|
+
|
11
|
+
* Upgrade to md2man 4.0, which no longer expands cross references in code
|
12
|
+
spans and code blocks. Your manuals might be rendered differently now.
|
13
|
+
|
1
14
|
## Version 3.4.1 (2014-07-01)
|
2
15
|
|
3
16
|
This release fixes the help options' REGEXP argument under non-Debian systems.
|
data/bin/binman
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
=begin =======================================================================
|
3
3
|
|
4
|
-
# BINMAN 1 2014-
|
4
|
+
# BINMAN 1 2014-10-26 4.0.0
|
5
5
|
|
6
6
|
## NAME
|
7
7
|
|
@@ -64,6 +64,18 @@ The following [Redcarpet] extensions are enabled while processing markdown(7):
|
|
64
64
|
|
65
65
|
## COMMANDS
|
66
66
|
|
67
|
+
`snip` [*FILE*]
|
68
|
+
Print the leading comment header extracted from the given *FILE* or STDIN.
|
69
|
+
|
70
|
+
`dump` [*FILE*]
|
71
|
+
Print the roff(7) conversion of the leading comment header extracted from
|
72
|
+
the given *FILE* or STDIN.
|
73
|
+
|
74
|
+
`show` [*FILE*] [*PATTERN*]
|
75
|
+
Use man(1) to display the roff(7) conversion of the leading comment header
|
76
|
+
extracted from the given *FILE* or STDIN. If *PATTERN* is given, search for
|
77
|
+
it within the output displayed by man(1) and jump to first match if found.
|
78
|
+
|
67
79
|
`help` *FILE* ... [`-h`|`--help` [*PATTERN*]] ... [`--`] ...
|
68
80
|
If the given argument sequence contains `-h` or `--help`, except after
|
69
81
|
`--`, optionally followed by a *PATTERN* regular expression that specifies
|
@@ -72,22 +84,6 @@ The following [Redcarpet] extensions are enabled while processing markdown(7):
|
|
72
84
|
converts it into roff(7), displays it using man(1), and finally exits with
|
73
85
|
status code `0`. Otherwise, this program exits with status code `111`.
|
74
86
|
|
75
|
-
`show` [*FILE*] [*PATTERN*]
|
76
|
-
Use man(1) to display the roff(7) conversion of the leading comment header
|
77
|
-
extracted from the given *FILE* or STDIN. If *PATTERN* is given, search for
|
78
|
-
it within the output displayed by man(1) and jump to first match if found.
|
79
|
-
|
80
|
-
`load` [*FILE*]
|
81
|
-
Print the leading comment header extracted from the given *FILE* or STDIN.
|
82
|
-
|
83
|
-
`dump` [*FILE*]
|
84
|
-
Print the roff(7) conversion of the leading comment header extracted from
|
85
|
-
the given *FILE* or STDIN.
|
86
|
-
|
87
|
-
`conv` [*FILE*]
|
88
|
-
Print the roff(7) conversion of the markdown(7) document read from the given
|
89
|
-
*FILE* or STDIN.
|
90
|
-
|
91
87
|
## SEE ALSO
|
92
88
|
|
93
89
|
binman-rake(1), man(1), roff(7), markdown(7)
|
@@ -111,7 +107,7 @@ else
|
|
111
107
|
case command
|
112
108
|
when 'show'
|
113
109
|
BinMan.send(command, source)
|
114
|
-
when '
|
110
|
+
when 'snip', 'dump'
|
115
111
|
puts BinMan.send(command, source)
|
116
112
|
else
|
117
113
|
warn 'binman: invalid command; try --help'
|
data/bin/binman-rake
CHANGED
data/binman.gemspec
CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |s|
|
|
18
18
|
|
19
19
|
s.files += Dir['man/man?/*.?'] # UNIX man pages
|
20
20
|
s.files += Dir['man/**/*.{html,css,js}'] # HTML man pages
|
21
|
-
s.add_development_dependency 'md2man', '~>
|
21
|
+
s.add_development_dependency 'md2man', '~> 4.0'
|
22
22
|
|
23
23
|
s.add_dependency 'opener', '>= 0.1.0', '< 1'
|
24
24
|
s.add_development_dependency 'rake', '~> 10.1'
|
data/lib/binman.rb
CHANGED
@@ -15,7 +15,7 @@ module BinMan
|
|
15
15
|
#
|
16
16
|
# Comment markers and shebang/encoding comments are omitted from result.
|
17
17
|
#
|
18
|
-
def
|
18
|
+
def snip source=nil
|
19
19
|
header = read(source)
|
20
20
|
|
21
21
|
# strip shebang and encoding comments
|
@@ -30,22 +30,16 @@ module BinMan
|
|
30
30
|
end.strip
|
31
31
|
end
|
32
32
|
|
33
|
-
# Converts given markdown(7) source into roff(7).
|
34
|
-
def conv source=nil
|
35
|
-
require_md2man
|
36
|
-
require 'md2man/roff/engine'
|
37
|
-
Md2Man::Roff::ENGINE.render(read(source))
|
38
|
-
end
|
39
|
-
|
40
33
|
# Extracts leading comment header content from given
|
41
34
|
# source and returns the roff(7) conversion thereof.
|
42
35
|
def dump source=nil
|
43
|
-
conv
|
36
|
+
conv snip(source)
|
44
37
|
end
|
45
38
|
|
46
39
|
# Shows leading comment header from given source as UNIX man page and
|
47
40
|
# optionally jumps to first match of query regular expression if given.
|
48
41
|
# If not possible, falls back to showing leading comment header as-is.
|
42
|
+
# Tries to display a pre-rendered UNIX man page under ./man/ if possible.
|
49
43
|
def show source=nil, query=nil
|
50
44
|
# try showing existing man page files for given source
|
51
45
|
if file = find(source) and File.exist? file
|
@@ -69,7 +63,7 @@ module BinMan
|
|
69
63
|
end
|
70
64
|
|
71
65
|
# fall back to showing leading comment header as-is
|
72
|
-
header =
|
66
|
+
header = snip(source)
|
73
67
|
|
74
68
|
begin
|
75
69
|
roff = conv(header)
|
@@ -98,15 +92,6 @@ module BinMan
|
|
98
92
|
end
|
99
93
|
end
|
100
94
|
|
101
|
-
# Requires that the correct version of Md2Man is available on this system.
|
102
|
-
def require_md2man
|
103
|
-
require 'rubygems' unless respond_to? :gem
|
104
|
-
gem 'md2man', '~> 3.0' if respond_to? :gem
|
105
|
-
require 'md2man/version'
|
106
|
-
rescue LoadError
|
107
|
-
raise 'Run `gem install md2man --version "~> 3.0"` to use BinMan::conv().'
|
108
|
-
end
|
109
|
-
|
110
95
|
private
|
111
96
|
|
112
97
|
# Launches man(1) with the given arguments and then tries to search for the
|
@@ -122,6 +107,14 @@ private
|
|
122
107
|
end or system 'man', *argv
|
123
108
|
end
|
124
109
|
|
110
|
+
# Converts given markdown(7) source into roff(7).
|
111
|
+
def conv source=nil
|
112
|
+
require 'md2man/roff/engine'
|
113
|
+
Md2Man::Roff::ENGINE.render(read(source))
|
114
|
+
rescue LoadError
|
115
|
+
raise 'Run `gem install md2man` to use BinMan::dump() or BinMan::show().'
|
116
|
+
end
|
117
|
+
|
125
118
|
# Returns contents of given source I/O, file name, or string.
|
126
119
|
def read source=nil
|
127
120
|
if source.respond_to? :read
|
data/lib/binman/rakefile.rb
CHANGED
@@ -17,7 +17,7 @@ mkds = bins.pathmap("#{dir}/%n.1.markdown")
|
|
17
17
|
|
18
18
|
bins.zip(mkds).each do |src, dst|
|
19
19
|
file dst => [dir, src] do
|
20
|
-
output = BinMan.
|
20
|
+
output = BinMan.snip(src)
|
21
21
|
File.open(dst, 'w') {|f| f << output }
|
22
22
|
end
|
23
23
|
end
|
@@ -26,7 +26,6 @@ end
|
|
26
26
|
desc 'Build UNIX manual pages for bin/ scripts.'
|
27
27
|
task 'binman:man' => mkds do
|
28
28
|
#-----------------------------------------------------------------------------
|
29
|
-
BinMan.require_md2man
|
30
29
|
load 'md2man/rakefile.rb'
|
31
30
|
Rake::Task['md2man:man'].invoke
|
32
31
|
end
|
@@ -35,7 +34,6 @@ end
|
|
35
34
|
desc 'Build HTML manual pages for bin/ scripts.'
|
36
35
|
task 'binman:web' => mkds do
|
37
36
|
#-----------------------------------------------------------------------------
|
38
|
-
BinMan.require_md2man
|
39
37
|
load 'md2man/rakefile.rb'
|
40
38
|
Rake::Task['md2man:web'].invoke
|
41
39
|
end
|
data/lib/binman/version.rb
CHANGED
data/man/index.html
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
<html>
|
3
3
|
<head>
|
4
4
|
<meta charset="utf-8" />
|
5
|
-
<meta name="generator" content="md2man
|
5
|
+
<meta name="generator" content="md2man 4.0.0 https://github.com/sunaku/md2man" />
|
6
6
|
<title>man/index</title>
|
7
7
|
<link rel="stylesheet" href="style.css"/>
|
8
8
|
<!--[if lt IE 9]><script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
|
data/man/man0/README.html
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
<html>
|
3
3
|
<head>
|
4
4
|
<meta charset="utf-8" />
|
5
|
-
<meta name="generator" content="md2man
|
5
|
+
<meta name="generator" content="md2man 4.0.0 https://github.com/sunaku/md2man" />
|
6
6
|
<title>README</title>
|
7
7
|
<link rel="stylesheet" href="../style.css"/>
|
8
8
|
<!--[if lt IE 9]><script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
|
@@ -11,9 +11,9 @@
|
|
11
11
|
Simply <a href="https://sunaku.github.io/md2man/man/man5/md2man.5.html">document your script in Markdown</a> as a comment at the
|
12
12
|
top of your script and call <code>binman show</code> to display it as a UNIX manual page!
|
13
13
|
Or, call <code>binman help</code> to display your manual <em>only</em> when your script receives
|
14
|
-
with <code>-h</code> or <code>--help</code> command-line options. Or, call <code>binman
|
14
|
+
with <code>-h</code> or <code>--help</code> command-line options. Or, call <code>binman snip</code> to extract
|
15
15
|
the manual from your script for your own custom processing, outside of binman.
|
16
|
-
And that's not all: <a href="https://sunaku.github.io/binman/man/man1/binman.1.html">see the manual</a> for
|
16
|
+
And that's not all: <a href="https://sunaku.github.io/binman/man/man1/binman.1.html">see the manual page</a> for more possibilities!</p>
|
17
17
|
<ul>
|
18
18
|
<li>Manuals: <a href="https://sunaku.github.io/binman/man">https://sunaku.github.io/binman/man</a></li>
|
19
19
|
<li>Sources: <a href="https://github.com/sunaku/binman">https://github.com/sunaku/binman</a></li>
|
@@ -29,83 +29,84 @@ Perl, Python, Node.js, Tcl, AWK, UNIX shell, and more!</p></li>
|
|
29
29
|
<li><p>Individual extraction, conversion, and display commands.</p></li>
|
30
30
|
<li><p>Implemented in roughly 150 lines of pure Ruby code! :-)</p></li>
|
31
31
|
</ul>
|
32
|
-
<h3 id="demonstration"><a name="demonstration" href="#demonstration" class="md2man-permalink" title="permalink"></a>Demonstration</h3><p><img src="EXAMPLE.png" alt="Obligatory screen-shot of binman(1) in action!"></p><p>Here are some
|
32
|
+
<h3 id="demonstration"><a name="demonstration" href="#demonstration" class="md2man-permalink" title="permalink"></a>Demonstration</h3><p><img src="EXAMPLE.png" alt="Obligatory screen-shot of binman(1) in action!"></p><h4 id="what-can-binman-1-do"><a name="what-can-binman-1-do" href="#what-can-binman-1-do" class="md2man-permalink" title="permalink"></a>What can <a class="md2man-reference" href="../man1/binman.1.html">binman(1)</a> do?</h4><p>Here are some real examples of processed bin scripts to help you get started:</p>
|
33
33
|
<ul>
|
34
|
-
<li><a
|
35
|
-
<a href="https://
|
36
|
-
<a href="https://sunaku.github.io/tork/man/man1/tork.1
|
37
|
-
<a href="https://sunaku.github.io/tork/man/man1/tork.1">
|
38
|
-
<li><a
|
39
|
-
<a href="https://
|
40
|
-
<a href="https://sunaku.github.io/tork/man/man1/tork-runner.1
|
41
|
-
<a href="https://sunaku.github.io/tork/man/man1/tork-runner.1">
|
42
|
-
<li><a
|
43
|
-
<a href="https://
|
44
|
-
<a href="https://sunaku.github.io/tork/man/man1/tork-herald.1
|
45
|
-
<a href="https://sunaku.github.io/tork/man/man1/tork-herald.1">
|
46
|
-
<li><a
|
47
|
-
<a href="https://
|
48
|
-
<a href="https://sunaku.github.io/tork/man/man1/tork-driver.1
|
49
|
-
<a href="https://sunaku.github.io/tork/man/man1/tork-driver.1">
|
50
|
-
<li><a
|
51
|
-
<a href="https://
|
52
|
-
<a href="https://sunaku.github.io/tork/man/man1/tork-engine.1
|
53
|
-
<a href="https://sunaku.github.io/tork/man/man1/tork-engine.1">
|
54
|
-
<li><a
|
55
|
-
<a href="https://
|
56
|
-
<a href="https://sunaku.github.io/tork/man/man1/tork-master.1
|
57
|
-
<a href="https://sunaku.github.io/tork/man/man1/tork-master.1">
|
58
|
-
<li><a
|
59
|
-
<a href="https://
|
60
|
-
<a href="https://sunaku.github.io/tork/man/man1/tork-remote.1
|
61
|
-
<a href="https://sunaku.github.io/tork/man/man1/tork-remote.1">
|
62
|
-
<li><a
|
63
|
-
<a href="https://
|
64
|
-
<a href="https://sunaku.github.io/tork/man/man1/tork-notify.1
|
65
|
-
<a href="https://sunaku.github.io/tork/man/man1/tork-notify.1">
|
66
|
-
<li><a
|
67
|
-
<a href="https://
|
68
|
-
<a href="https://sunaku.github.io/md2man/man/man1/md2man-roff.1
|
69
|
-
<a href="https://sunaku.github.io/md2man/man/man1/md2man-roff.1">roff
|
70
|
-
<li><a
|
71
|
-
<a href="https://
|
72
|
-
<a href="https://sunaku.github.io/md2man/man/man1/md2man-html.1
|
73
|
-
<a href="https://sunaku.github.io/md2man/man/man1/md2man-html.1">
|
74
|
-
<li><a
|
75
|
-
<a href="https://
|
76
|
-
<a href="https://sunaku.github.io/md2man/man/man1/md2man-rake.1
|
77
|
-
<a href="https://sunaku.github.io/md2man/man/man1/md2man-rake.1">
|
78
|
-
<li><a
|
79
|
-
<a href="https://
|
80
|
-
<a href="https://sunaku.github.io/binman/man/man1/binman.1
|
81
|
-
<a href="https://sunaku.github.io/binman/man/man1/binman.1">
|
82
|
-
<li><a
|
83
|
-
<a href="https://
|
84
|
-
<a href="https://sunaku.github.io/binman/man/man1/binman-rake.1
|
85
|
-
<a href="https://sunaku.github.io/binman/man/man1/binman-rake.1">
|
34
|
+
<li><a href="https://raw.github.com/sunaku/tork/master/bin/tork">bin/tork</a> ⇒
|
35
|
+
<a href="https://sunaku.github.io/tork/man/man1/tork.1.markdown">tork.1.markdown</a> ⇒
|
36
|
+
<a href="https://sunaku.github.io/tork/man/man1/tork.1">tork.1</a> +
|
37
|
+
<a href="https://sunaku.github.io/tork/man/man1/tork.1.html">tork.1.html</a></li>
|
38
|
+
<li><a href="https://raw.github.com/sunaku/tork/master/bin/tork-runner">bin/tork-runner</a> ⇒
|
39
|
+
<a href="https://sunaku.github.io/tork/man/man1/tork-runner.1.markdown">tork-runner.1.markdown</a> ⇒
|
40
|
+
<a href="https://sunaku.github.io/tork/man/man1/tork-runner.1">tork-runner.1</a> +
|
41
|
+
<a href="https://sunaku.github.io/tork/man/man1/tork-runner.1.html">tork-runner.1.html</a></li>
|
42
|
+
<li><a href="https://raw.github.com/sunaku/tork/master/bin/tork-herald">bin/tork-herald</a> ⇒
|
43
|
+
<a href="https://sunaku.github.io/tork/man/man1/tork-herald.1.markdown">tork-herald.1.markdown</a> ⇒
|
44
|
+
<a href="https://sunaku.github.io/tork/man/man1/tork-herald.1">tork-herald.1</a> +
|
45
|
+
<a href="https://sunaku.github.io/tork/man/man1/tork-herald.1.html">tork-herald.1.html</a></li>
|
46
|
+
<li><a href="https://raw.github.com/sunaku/tork/master/bin/tork-driver">bin/tork-driver</a> ⇒
|
47
|
+
<a href="https://sunaku.github.io/tork/man/man1/tork-driver.1.markdown">tork-driver.1.markdown</a> ⇒
|
48
|
+
<a href="https://sunaku.github.io/tork/man/man1/tork-driver.1">tork-driver.1</a> +
|
49
|
+
<a href="https://sunaku.github.io/tork/man/man1/tork-driver.1.html">tork-driver.1.html</a></li>
|
50
|
+
<li><a href="https://raw.github.com/sunaku/tork/master/bin/tork-engine">bin/tork-engine</a> ⇒
|
51
|
+
<a href="https://sunaku.github.io/tork/man/man1/tork-engine.1.markdown">tork-engine.1.markdown</a> ⇒
|
52
|
+
<a href="https://sunaku.github.io/tork/man/man1/tork-engine.1">tork-engine.1</a> +
|
53
|
+
<a href="https://sunaku.github.io/tork/man/man1/tork-engine.1.html">tork-engine.1.html</a></li>
|
54
|
+
<li><a href="https://raw.github.com/sunaku/tork/master/bin/tork-master">bin/tork-master</a> ⇒
|
55
|
+
<a href="https://sunaku.github.io/tork/man/man1/tork-master.1.markdown">tork-master.1.markdown</a> ⇒
|
56
|
+
<a href="https://sunaku.github.io/tork/man/man1/tork-master.1">tork-master.1</a> +
|
57
|
+
<a href="https://sunaku.github.io/tork/man/man1/tork-master.1.html">tork-master.1.html</a></li>
|
58
|
+
<li><a href="https://raw.github.com/sunaku/tork/master/bin/tork-remote">bin/tork-remote</a> ⇒
|
59
|
+
<a href="https://sunaku.github.io/tork/man/man1/tork-remote.1.markdown">tork-remote.1.markdown</a> ⇒
|
60
|
+
<a href="https://sunaku.github.io/tork/man/man1/tork-remote.1">tork-remote.1</a> +
|
61
|
+
<a href="https://sunaku.github.io/tork/man/man1/tork-remote.1.html">tork-remote.1.html</a></li>
|
62
|
+
<li><a href="https://raw.github.com/sunaku/tork/master/bin/tork-notify">bin/tork-notify</a> ⇒
|
63
|
+
<a href="https://sunaku.github.io/tork/man/man1/tork-notify.1.markdown">tork-notify.1.markdown</a> ⇒
|
64
|
+
<a href="https://sunaku.github.io/tork/man/man1/tork-notify.1">tork-notify.1</a> +
|
65
|
+
<a href="https://sunaku.github.io/tork/man/man1/tork-notify.1.html">tork-notify.1.html</a></li>
|
66
|
+
<li><a href="https://raw.github.com/sunaku/md2man/master/bin/md2man-roff">bin/md2man-roff</a> ⇒
|
67
|
+
<a href="https://sunaku.github.io/md2man/man/man1/md2man-roff.1.markdown">md2man-roff.1.markdown</a> ⇒
|
68
|
+
<a href="https://sunaku.github.io/md2man/man/man1/md2man-roff.1">md2man-roff.1</a> +
|
69
|
+
<a href="https://sunaku.github.io/md2man/man/man1/md2man-roff.1.html">md2man-roff.1.html</a></li>
|
70
|
+
<li><a href="https://raw.github.com/sunaku/md2man/master/bin/md2man-html">bin/md2man-html</a> ⇒
|
71
|
+
<a href="https://sunaku.github.io/md2man/man/man1/md2man-html.1.markdown">md2man-html.1.markdown</a> ⇒
|
72
|
+
<a href="https://sunaku.github.io/md2man/man/man1/md2man-html.1">md2man-html.1</a> +
|
73
|
+
<a href="https://sunaku.github.io/md2man/man/man1/md2man-html.1.html">md2man-html.1.html</a></li>
|
74
|
+
<li><a href="https://raw.github.com/sunaku/md2man/master/bin/md2man-rake">bin/md2man-rake</a> ⇒
|
75
|
+
<a href="https://sunaku.github.io/md2man/man/man1/md2man-rake.1.markdown">md2man-rake.1.markdown</a> ⇒
|
76
|
+
<a href="https://sunaku.github.io/md2man/man/man1/md2man-rake.1">md2man-rake.1</a> +
|
77
|
+
<a href="https://sunaku.github.io/md2man/man/man1/md2man-rake.1.html">md2man-rake.1.html</a></li>
|
78
|
+
<li><a href="https://raw.github.com/sunaku/binman/master/bin/binman">bin/binman</a> ⇒
|
79
|
+
<a href="https://sunaku.github.io/binman/man/man1/binman.1.markdown">binman.1.markdown</a> ⇒
|
80
|
+
<a href="https://sunaku.github.io/binman/man/man1/binman.1">binman.1</a> +
|
81
|
+
<a href="https://sunaku.github.io/binman/man/man1/binman.1.html">binman.1.html</a></li>
|
82
|
+
<li><a href="https://raw.github.com/sunaku/binman/master/bin/binman-rake">bin/binman-rake</a> ⇒
|
83
|
+
<a href="https://sunaku.github.io/binman/man/man1/binman-rake.1.markdown">binman-rake.1.markdown</a> ⇒
|
84
|
+
<a href="https://sunaku.github.io/binman/man/man1/binman-rake.1">binman-rake.1</a> +
|
85
|
+
<a href="https://sunaku.github.io/binman/man/man1/binman-rake.1.html">binman-rake.1.html</a></li>
|
86
86
|
</ul>
|
87
|
-
<p>For examples in
|
88
|
-
<
|
87
|
+
<p>For examples in even more scripting languages, see the "Usage" section below!</p><h4 id="what-can-binman-rake-1-do"><a name="what-can-binman-rake-1-do" href="#what-can-binman-rake-1-do" class="md2man-permalink" title="permalink"></a>What can <a class="md2man-reference" href="../man1/binman-rake.1.html">binman-rake(1)</a> do?</h4><p>Here are some examples of HTML manual <em>sets</em> produced by <a class="md2man-reference" href="../man1/binman-rake.1.html">binman-rake(1)</a>:</p>
|
88
|
+
<ul>
|
89
|
+
<li><a href="https://sunaku.github.io/tork/man">https://sunaku.github.io/tork/man</a></li>
|
90
|
+
<li><a href="https://sunaku.github.io/binman/man">https://sunaku.github.io/binman/man</a></li>
|
91
|
+
<li><a href="https://sunaku.github.io/md2man/man">https://sunaku.github.io/md2man/man</a></li>
|
92
|
+
</ul>
|
93
|
+
<h2 id="installation"><a name="installation" href="#installation" class="md2man-permalink" title="permalink"></a>Installation</h2><p>If you only want to view pre-built manual pages:</p><pre><code>gem install binman
|
89
94
|
</code></pre>
|
90
|
-
<p>If you also want to build your own manual pages:</p>
|
91
|
-
<pre><code class="sh">gem install md2man -v '~> 3.0'
|
95
|
+
<p>If you also want to build your own manual pages:</p><pre><code>gem install md2man -v '~> 4.0'
|
92
96
|
</code></pre>
|
93
97
|
<h3 id="prerequisites"><a name="prerequisites" href="#prerequisites" class="md2man-permalink" title="permalink"></a>Prerequisites</h3>
|
94
98
|
<ul>
|
95
99
|
<li>Ruby 1.8.7 or 1.9.2 or newer.</li>
|
96
100
|
</ul>
|
97
|
-
<h3 id="development"><a name="development" href="#development" class="md2man-permalink" title="permalink"></a>Development</h3>
|
98
|
-
<pre><code class="sh">git clone git://github.com/sunaku/binman
|
101
|
+
<h3 id="development"><a name="development" href="#development" class="md2man-permalink" title="permalink"></a>Development</h3><pre><code>git clone git://github.com/sunaku/binman
|
99
102
|
cd binman
|
100
103
|
bundle install
|
101
104
|
bundle exec binman --help # run it directly
|
102
105
|
bundle exec rake --tasks # packaging tasks
|
103
106
|
</code></pre>
|
104
|
-
<h2 id="usage"><a name="usage" href="#usage" class="md2man-permalink" title="permalink"></a>Usage</h2><h3 id="at-the-command-line"><a name="at-the-command-line" href="#at-the-command-line" class="md2man-permalink" title="permalink"></a>At the command line</h3><p>See <a class="md2man-reference" href="../man1/binman.1.html">binman(1)</a> manual:</p>
|
105
|
-
<pre><code class="sh">binman --help
|
107
|
+
<h2 id="usage"><a name="usage" href="#usage" class="md2man-permalink" title="permalink"></a>Usage</h2><h3 id="at-the-command-line"><a name="at-the-command-line" href="#at-the-command-line" class="md2man-permalink" title="permalink"></a>At the command line</h3><p>See <a class="md2man-reference" href="../man1/binman.1.html">binman(1)</a> manual:</p><pre><code>binman --help
|
106
108
|
</code></pre>
|
107
|
-
<h3 id="inside-a-ruby-script"><a name="inside-a-ruby-script" href="#inside-a-ruby-script" class="md2man-permalink" title="permalink"></a>Inside a Ruby script</h3
|
108
|
-
<pre><code class="ruby">#!/usr/bin/env ruby
|
109
|
+
<h3 id="inside-a-ruby-script"><a name="inside-a-ruby-script" href="#inside-a-ruby-script" class="md2man-permalink" title="permalink"></a>Inside a Ruby script</h3><pre><code>#!/usr/bin/env ruby
|
109
110
|
# your program's manual page goes here
|
110
111
|
|
111
112
|
require 'binman'
|
@@ -116,26 +117,22 @@ BinMan.help
|
|
116
117
|
# OPTION 2: show manual unconditionally
|
117
118
|
BinMan.show
|
118
119
|
</code></pre>
|
119
|
-
<p>You can also specify your program's source file encoding above the manual:</p
|
120
|
-
<pre><code class="ruby">#!/usr/bin/env ruby
|
120
|
+
<p>You can also specify your program's source file encoding above the manual:</p><pre><code>#!/usr/bin/env ruby
|
121
121
|
# -*- coding: utf-8 -*-
|
122
122
|
# your program's manual page goes here
|
123
123
|
</code></pre>
|
124
|
-
<p>You can also write the manual as a multi-line Ruby comment:</p
|
125
|
-
<pre><code class="ruby">#!/usr/bin/env ruby
|
124
|
+
<p>You can also write the manual as a multi-line Ruby comment:</p><pre><code>#!/usr/bin/env ruby
|
126
125
|
=begin
|
127
126
|
your program's manual page goes here
|
128
127
|
=end
|
129
128
|
</code></pre>
|
130
|
-
<p>You can also specify your program's source file encoding above the manual:</p
|
131
|
-
<pre><code class="ruby">#!/usr/bin/env ruby
|
129
|
+
<p>You can also specify your program's source file encoding above the manual:</p><pre><code>#!/usr/bin/env ruby
|
132
130
|
# -*- coding: utf-8 -*-
|
133
131
|
=begin
|
134
132
|
your program's manual page goes here
|
135
133
|
=end
|
136
134
|
</code></pre>
|
137
|
-
<p>See the <a href="http://rubydoc.info/gems/binman/frames">API documentation</a> for even more possibilities!</p><h3 id="inside-a-shell-script"><a name="inside-a-shell-script" href="#inside-a-shell-script" class="md2man-permalink" title="permalink"></a>Inside a shell script</h3
|
138
|
-
<pre><code class="ruby">#!/usr/bin/sh
|
135
|
+
<p>See the <a href="http://rubydoc.info/gems/binman/frames">API documentation</a> for even more possibilities!</p><h3 id="inside-a-shell-script"><a name="inside-a-shell-script" href="#inside-a-shell-script" class="md2man-permalink" title="permalink"></a>Inside a shell script</h3><pre><code>#!/usr/bin/sh
|
139
136
|
# your program's manual page goes here
|
140
137
|
|
141
138
|
# OPTION 1: show manual and exit if ARGV has -h or --help except after --
|
@@ -144,8 +141,7 @@ binman help "$0" "$@" && exit
|
|
144
141
|
# OPTION 2: show manual unconditionally
|
145
142
|
binman show "$0"
|
146
143
|
</code></pre>
|
147
|
-
<h3 id="inside-a-perl-script"><a name="inside-a-perl-script" href="#inside-a-perl-script" class="md2man-permalink" title="permalink"></a>Inside a Perl script</h3
|
148
|
-
<pre><code class="perl">#!/usr/bin/env perl
|
144
|
+
<h3 id="inside-a-perl-script"><a name="inside-a-perl-script" href="#inside-a-perl-script" class="md2man-permalink" title="permalink"></a>Inside a Perl script</h3><pre><code>#!/usr/bin/env perl
|
149
145
|
# your program's manual page goes here
|
150
146
|
|
151
147
|
# OPTION 1: show manual and exit if ARGV has -h or --help except after --
|
@@ -154,16 +150,14 @@ system('binman', 'help', __FILE__, @ARGV) == 0 and exit;
|
|
154
150
|
# OPTION 2: show manual unconditionally
|
155
151
|
system('binman', 'show', __FILE__);
|
156
152
|
</code></pre>
|
157
|
-
<p>You can also write the manual as a multi-line Ruby comment after <code>__END__</code>:</p
|
158
|
-
<pre><code class="perl">#!/usr/bin/env perl
|
153
|
+
<p>You can also write the manual as a multi-line Ruby comment after <code>__END__</code>:</p><pre><code>#!/usr/bin/env perl
|
159
154
|
print "your program's code goes here";
|
160
155
|
__END__
|
161
156
|
=begin
|
162
157
|
your program's manual page goes here
|
163
158
|
=end
|
164
159
|
</code></pre>
|
165
|
-
<h3 id="inside-a-python-script"><a name="inside-a-python-script" href="#inside-a-python-script" class="md2man-permalink" title="permalink"></a>Inside a Python script</h3
|
166
|
-
<pre><code class="python">#!/usr/bin/env python
|
160
|
+
<h3 id="inside-a-python-script"><a name="inside-a-python-script" href="#inside-a-python-script" class="md2man-permalink" title="permalink"></a>Inside a Python script</h3><pre><code>#!/usr/bin/env python
|
167
161
|
# your program's manual page goes here
|
168
162
|
|
169
163
|
import sys, subprocess
|
@@ -174,21 +168,18 @@ subprocess.call(['binman', 'help', __file__] + sys.argv) == 0 an
|
|
174
168
|
# OPTION 2: show manual unconditionally
|
175
169
|
subprocess.call(['binman', 'show', __file__])
|
176
170
|
</code></pre>
|
177
|
-
<p>You can also specify your program's source file encoding above the manual:</p
|
178
|
-
<pre><code class="python">#!/usr/bin/env python
|
171
|
+
<p>You can also specify your program's source file encoding above the manual:</p><pre><code>#!/usr/bin/env python
|
179
172
|
# -*- coding: utf-8 -*-
|
180
173
|
# your program's manual page goes here
|
181
174
|
</code></pre>
|
182
|
-
<p>You can also write the manual as a multi-line Ruby comment inside a docstring:</p
|
183
|
-
<pre><code class="python">#!/usr/bin/env python
|
175
|
+
<p>You can also write the manual as a multi-line Ruby comment inside a docstring:</p><pre><code>#!/usr/bin/env python
|
184
176
|
"""
|
185
177
|
=begin
|
186
178
|
your program's manual page goes here
|
187
179
|
=end
|
188
180
|
"""
|
189
181
|
</code></pre>
|
190
|
-
<p>You can also specify your program's source file encoding above the manual:</p
|
191
|
-
<pre><code class="python">#!/usr/bin/env python
|
182
|
+
<p>You can also specify your program's source file encoding above the manual:</p><pre><code>#!/usr/bin/env python
|
192
183
|
# -*- coding: utf-8 -*-
|
193
184
|
"""
|
194
185
|
=begin
|
@@ -196,8 +187,7 @@ your program's manual page goes here
|
|
196
187
|
=end
|
197
188
|
"""
|
198
189
|
</code></pre>
|
199
|
-
<h3 id="inside-an-awk-script"><a name="inside-an-awk-script" href="#inside-an-awk-script" class="md2man-permalink" title="permalink"></a>Inside an AWK script</h3><p>The technique for determining current AWK script file name <a href="http://www.mombu.com/programming/programming/t-the-name-of-script-itself-2040784-print.html">comes from here</a>.</p
|
200
|
-
<pre><code class="awk">#!/usr/bin/awk -f
|
190
|
+
<h3 id="inside-an-awk-script"><a name="inside-an-awk-script" href="#inside-an-awk-script" class="md2man-permalink" title="permalink"></a>Inside an AWK script</h3><p>The technique for determining current AWK script file name <a href="http://www.mombu.com/programming/programming/t-the-name-of-script-itself-2040784-print.html">comes from here</a>.</p><pre><code>#!/usr/bin/awk -f
|
201
191
|
# your program's manual page goes here
|
202
192
|
|
203
193
|
# OPTION 1: show manual and exit if ARGV has -h or --help except after --
|
@@ -208,8 +198,7 @@ BEGIN {getline c <"/proc/self/cmdline"; sub(".*-f\0",&quo
|
|
208
198
|
BEGIN {getline c <"/proc/self/cmdline"; sub(".*-f\0"," ",c); sub("\0.*","",c);
|
209
199
|
system("binman show" c)}
|
210
200
|
</code></pre>
|
211
|
-
<h3 id="inside-a-tcl-script"><a name="inside-a-tcl-script" href="#inside-a-tcl-script" class="md2man-permalink" title="permalink"></a>Inside a Tcl script</h3
|
212
|
-
<pre><code class="tcl">#!/usr/bin/env tclsh
|
201
|
+
<h3 id="inside-a-tcl-script"><a name="inside-a-tcl-script" href="#inside-a-tcl-script" class="md2man-permalink" title="permalink"></a>Inside a Tcl script</h3><pre><code>#!/usr/bin/env tclsh
|
213
202
|
# your program's manual page goes here
|
214
203
|
|
215
204
|
# OPTION 1: show manual and exit if ARGV has -h or --help except after --
|
@@ -218,16 +207,14 @@ if {![catch {exec -- >/dev/tty binman help $argv0 {*}$argv}]} {exit}
|
|
218
207
|
# OPTION 2: show manual unconditionally
|
219
208
|
exec >/dev/tty binman show $argv0
|
220
209
|
</code></pre>
|
221
|
-
<p>You can also write the manual as a multi-line Ruby comment inside an <code>if 0</code>:</p
|
222
|
-
<pre><code class="tcl">#!/usr/bin/env tclsh
|
210
|
+
<p>You can also write the manual as a multi-line Ruby comment inside an <code>if 0</code>:</p><pre><code>#!/usr/bin/env tclsh
|
223
211
|
if 0 {
|
224
212
|
=begin
|
225
213
|
your program's manual page goes here
|
226
214
|
=end
|
227
215
|
}
|
228
216
|
</code></pre>
|
229
|
-
<h3 id="inside-a-node-js-script"><a name="inside-a-node-js-script" href="#inside-a-node-js-script" class="md2man-permalink" title="permalink"></a>Inside a Node.js script</h3
|
230
|
-
<pre><code class="javascript">/*
|
217
|
+
<h3 id="inside-a-node-js-script"><a name="inside-a-node-js-script" href="#inside-a-node-js-script" class="md2man-permalink" title="permalink"></a>Inside a Node.js script</h3><pre><code>/*
|
231
218
|
=begin
|
232
219
|
your program's manual page goes here
|
233
220
|
=end
|
@@ -237,28 +224,24 @@ var exec = require('child_process').exec;
|
|
237
224
|
|
238
225
|
// OPTION 1: show manual and exit if ARGV has -h or --help except after --
|
239
226
|
exec(['>/dev/tty', 'binman', 'help', __filename].concat(process.argv).
|
240
|
-
join(' '),
|
227
|
+
join(' '), function(error){ if (error === null){ process.exit(); } });
|
241
228
|
|
242
229
|
// OPTION 2: show manual unconditionally
|
243
230
|
exec(['>/dev/tty', 'binman', 'show', __filename].join(' '));
|
244
231
|
</code></pre>
|
245
|
-
<h2 id="packaging"><a name="packaging" href="#packaging" class="md2man-permalink" title="permalink"></a>Packaging</h2><h3 id="building-man-pages"><a name="building-man-pages" href="#building-man-pages" class="md2man-permalink" title="permalink"></a>Building man pages</h3><h4 id="at-the-command-line-1"><a name="at-the-command-line-1" href="#at-the-command-line-1" class="md2man-permalink" title="permalink"></a>At the command line</h4><p>See <a class="md2man-reference" href="../man1/binman-rake.1.html">binman-rake(1)</a> manual:</p>
|
246
|
-
<pre><code class="sh">binman-rake --help
|
232
|
+
<h2 id="packaging"><a name="packaging" href="#packaging" class="md2man-permalink" title="permalink"></a>Packaging</h2><h3 id="building-man-pages"><a name="building-man-pages" href="#building-man-pages" class="md2man-permalink" title="permalink"></a>Building man pages</h3><h4 id="at-the-command-line-1"><a name="at-the-command-line-1" href="#at-the-command-line-1" class="md2man-permalink" title="permalink"></a>At the command line</h4><p>See <a class="md2man-reference" href="../man1/binman-rake.1.html">binman-rake(1)</a> manual:</p><pre><code>binman-rake --help
|
247
233
|
</code></pre>
|
248
|
-
<h4 id="inside-a-ruby-script-1"><a name="inside-a-ruby-script-1" href="#inside-a-ruby-script-1" class="md2man-permalink" title="permalink"></a>Inside a Ruby script</h4><p>Add this snippet to your gemspec file:</p>
|
249
|
-
<pre><code class="ruby">s.files += Dir['man/man?/*.?'] # UNIX man pages
|
234
|
+
<h4 id="inside-a-ruby-script-1"><a name="inside-a-ruby-script-1" href="#inside-a-ruby-script-1" class="md2man-permalink" title="permalink"></a>Inside a Ruby script</h4><p>Add this snippet to your gemspec file:</p><pre><code>s.files += Dir['man/man?/*.?'] # UNIX man pages
|
250
235
|
s.files += Dir['man/**/*.{html,css,js}'] # HTML man pages
|
251
|
-
s.add_development_dependency 'md2man', '~>
|
236
|
+
s.add_development_dependency 'md2man', '~> 4.0'
|
252
237
|
</code></pre>
|
253
|
-
<p>Add the following line to your Rakefile:</p>
|
254
|
-
<pre><code class="ruby">require 'binman/rakefile'
|
238
|
+
<p>Add the following line to your Rakefile:</p><pre><code>require 'binman/rakefile'
|
255
239
|
</code></pre>
|
256
240
|
<p>You now have a <code>rake binman</code> task that pre-builds UNIX manual page files for
|
257
241
|
your <code>bin/</code> scripts into a <code>man/</code> directory so that your end-users do not need
|
258
242
|
<a href="https://github.com/sunaku/md2man">md2man</a> installed in order to view the manual pages you've embedded therein!
|
259
243
|
There are also sub-tasks to build manual pages individually as <a href="http://troff.org">roff</a> or HTML.</p><p>If you're using Bundler, this task also hooks into its gem packaging tasks and
|
260
|
-
ensures that your UNIX manual pages are pre-built and packaged into your gem:</p>
|
261
|
-
<pre><code class="shell">bundle exec rake build
|
244
|
+
ensures that your UNIX manual pages are pre-built and packaged into your gem:</p><pre><code>bundle exec rake build
|
262
245
|
gem spec pkg/*.gem | fgrep man/man
|
263
246
|
</code></pre>
|
264
247
|
<h2 id="license"><a name="license" href="#license" class="md2man-permalink" title="permalink"></a>License</h2><p>Released under the ISC license. See the LICENSE file for details.</p></div></body>
|