bcat 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -21,7 +21,7 @@ addition to being piped into the browser.
21
21
  immediately begins streaming input. The following options control the browser
22
22
  display:
23
23
 
24
- * `-b`, `--browser`=default|firefox|safari|chrome|opera|<other>
24
+ * `-b`, `--browser`=default|firefox|safari|chrome|opera|<other>:
25
25
  The name of the browser application. Defaults to the value of the
26
26
  `BCAT_BROWSER` environment variable, or the system default browser when
27
27
  no `BCAT_BROWSER` is defined.
@@ -70,6 +70,72 @@ Miscellaneous options:
70
70
  (`-b`) option a no-op. This should only be necessary when running a
71
71
  browser unknown to bcat or in order to pass special arguments.
72
72
 
73
+ ## EXAMPLES
74
+
75
+ ### Basic Shell Examples
76
+
77
+ With build tools:
78
+
79
+ make test |bcat
80
+ rake test |bcat
81
+
82
+ As a clipboard viewer:
83
+
84
+ pbpaste |bcat # mac
85
+ xclip -o |bcat # X11
86
+
87
+ For previewing HTML:
88
+
89
+ markdown README.md |bcat
90
+ redcloth README.textile |bcat
91
+ erb -T - template.erb |bcat
92
+ mustache < template.mustache |bcat
93
+ pygmentize -Ofull,style=colorful -f html main.c |bcat
94
+
95
+ As a simple man pager:
96
+
97
+ export MANPAGER='col -b |bcat'
98
+ man grep
99
+
100
+ With git, selectively:
101
+
102
+ git log -p --color |bcat
103
+ git diff --color HEAD@{5d} HEAD |bcat
104
+
105
+ With git, as the default PAGER:
106
+
107
+ export GIT_PAGER=bcat
108
+
109
+ git log -p
110
+ git diff HEAD@{5d} HEAD
111
+
112
+ As a log viewer:
113
+
114
+ tail -n 1000 -f log/development.log |bcat
115
+ tail -f $RAILS_ROOT/log/development.log
116
+
117
+ Or, a remote log viewer:
118
+
119
+ ssh example.org 'tail -n 1000 -f /var/log/syslog' |bcat
120
+
121
+ ### Vim and vi Examples
122
+
123
+ Preview current buffer as HTML:
124
+
125
+ :!markdown % |bcat
126
+ :!ronn -5 --pipe % |bcat
127
+
128
+ Create keymappings:
129
+
130
+ map ,pm :!markdown % |bcat
131
+ map ,pp :!pygmentize -Ofull,style=colorful -f html % |bcat
132
+
133
+ Use with `makeprg`:
134
+
135
+ set makeprg=make\ \\\|bcat
136
+ set makeprg=markdown\ %\ \\\|bcat
137
+ set makeprg=testrb\ %\ \\\|bcat
138
+
73
139
  ## SEE ALSO
74
140
 
75
141
  cat(1), tee(1), open(1)
@@ -0,0 +1,225 @@
1
+ .\" generated with Ronn/v0.6.42
2
+ .\" http://github.com/rtomayko/ronn/tree/0.6.6-36-gb67d494
3
+ .
4
+ .TH "BCAT" "1" "June 2010" "Ryan Tomayko" "Bcat 0.4.0"
5
+ .
6
+ .SH "NAME"
7
+ \fBbcat\fR \- browser cat
8
+ .
9
+ .SH "SYNOPSIS"
10
+ \fBbcat\fR [\-htad] [\fIfile\fR\.\.\.]
11
+ .
12
+ .br
13
+ \fBbtee\fR [\-htad] [\fIfile\fR\.\.\.]
14
+ .
15
+ .SH "DESCRIPTION"
16
+ The \fBbcat\fR utility reads from standard input, or one or more \fIfile\fRs, and pipes output into a web browser\. \fIfile\fR may be \'\-\', in which case standard input is concatenated at that position\.
17
+ .
18
+ .P
19
+ When invoked as \fBbtee\fR, all input is written immediately to standard output in addition to being piped into the browser\.
20
+ .
21
+ .SH "OPTIONS"
22
+ \fBbcat\fR opens a simple, undecorated page with the system default web browser and immediately begins streaming input\. The following options control the browser display:
23
+ .
24
+ .TP
25
+ \fB\-b\fR, \fB\-\-browser\fR=default|firefox|safari|chrome|opera|\fIother\fR
26
+ The name of the browser application\. Defaults to the value of the \fBBCAT_BROWSER\fR environment variable, or the system default browser when no \fBBCAT_BROWSER\fR is defined\.
27
+ .
28
+ .TP
29
+ \fB\-T\fR, \fB\-\-title\fR=\fItext\fR
30
+ Use \fItext\fR as the page \fB<title>\fR\. By default, the path to the current working directory is used as the title\.
31
+ .
32
+ .TP
33
+ \fB\-a\fR, \fB\-\-ansi\fR
34
+ Turns on VT100/ANSI escape sequence conversion\. This causes all input to be piped through a2h(1), replacing ANSI escape sequences with HTML for things like bold, underline, and colors\. On by default when the input is text; use the \fB\-a\fR option to turn it on when the input is HTML\.
35
+ .
36
+ .P
37
+ By default, \fBbcat\fR attempts to detect whether input is HTML or plain text using a simple heuristic, but you can force input to be treated as one or the other with these options:
38
+ .
39
+ .TP
40
+ \fB\-t\fR, \fB\-\-text\fR
41
+ The input is non\-HTML encoded text\. All bare \fB<\fR and \fB&\fR characters are entity encoded, end\-of\-line characters are converted to \fB<br>\fR, and the entire output is wrapped in a \fB<pre>\fR\.
42
+ .
43
+ .TP
44
+ \fB\-h\fR, \fB\-\-html\fR
45
+ The input is already HTML encoded\. Under this mode, bcat passes input through to the browser mostly unmodified\. The input may be a full HTML document, or it may be an HTML fragment\. \fBbcat\fR outputs \fB<html>\fR, \fB<head>\fR, and \fB<body>\fR elements even if they are not included in the input\.
46
+ .
47
+ .P
48
+ Miscellaneous options:
49
+ .
50
+ .TP
51
+ \fB\-d\fR, \fB\-\-debug\fR
52
+ Turn on verbose debug logging to standard error\. Include this output when reporting defects if applicable\.
53
+ .
54
+ .SH "ENVIRONMENT"
55
+ .
56
+ .TP
57
+ \fBBCAT_BROWSER\fR=default|firefox|safari|chrome|opera|\fIother\fR
58
+ The name of the browser to use by default\. \fBbcat\fR maps this to an actual browser command based on the current platform\. The special value \"default\" maps to the system default browser\.
59
+ .
60
+ .TP
61
+ \fBBCAT_COMMAND\fR=\fIcommand\fR
62
+ The entire browser command line (to be executed by \fB/bin/sh\fR)\. This overrides the \fBBCAT_BROWSER\fR environment variable and makes the \fB\-\-browser\fR (\fB\-b\fR) option a no\-op\. This should only be necessary when running a browser unknown to bcat or in order to pass special arguments\.
63
+ .
64
+ .SH "EXAMPLES"
65
+ .
66
+ .SS "Basic Shell Examples"
67
+ With build tools:
68
+ .
69
+ .IP "" 4
70
+ .
71
+ .nf
72
+
73
+ make test |bcat
74
+ rake test |bcat
75
+ .
76
+ .fi
77
+ .
78
+ .IP "" 0
79
+ .
80
+ .P
81
+ As a clipboard viewer:
82
+ .
83
+ .IP "" 4
84
+ .
85
+ .nf
86
+
87
+ pbpaste |bcat
88
+ .
89
+ .fi
90
+ .
91
+ .IP "" 0
92
+ .
93
+ .P
94
+ For previewing HTML:
95
+ .
96
+ .IP "" 4
97
+ .
98
+ .nf
99
+
100
+ markdown README\.md |bcat
101
+ redcloth README\.textile |bcat
102
+ erb \-T \- template\.erb |bcat
103
+ mustache < template\.mustache |bcat
104
+ pygmentize \-Ofull,style=colorful \-f html main\.c |bcat
105
+ .
106
+ .fi
107
+ .
108
+ .IP "" 0
109
+ .
110
+ .P
111
+ As a simple man pager:
112
+ .
113
+ .IP "" 4
114
+ .
115
+ .nf
116
+
117
+ export MANPAGER=\'col \-b |bcat\'
118
+ man grep
119
+ .
120
+ .fi
121
+ .
122
+ .IP "" 0
123
+ .
124
+ .P
125
+ With git, selectively:
126
+ .
127
+ .IP "" 4
128
+ .
129
+ .nf
130
+
131
+ git log \-p \-\-color |bcat
132
+ git diff \-\-color HEAD@{5d} HEAD |bcat
133
+ .
134
+ .fi
135
+ .
136
+ .IP "" 0
137
+ .
138
+ .P
139
+ With git, as the default PAGER:
140
+ .
141
+ .IP "" 4
142
+ .
143
+ .nf
144
+
145
+ export GIT_PAGER=bcat
146
+
147
+ git log \-p
148
+ git diff HEAD@{5d} HEAD
149
+ .
150
+ .fi
151
+ .
152
+ .IP "" 0
153
+ .
154
+ .P
155
+ As a log viewer:
156
+ .
157
+ .IP "" 4
158
+ .
159
+ .nf
160
+
161
+ tail \-n 1000 \-f log/development\.log |bcat
162
+ tail \-f $RAILS_ROOT/log/development\.log
163
+ .
164
+ .fi
165
+ .
166
+ .IP "" 0
167
+ .
168
+ .P
169
+ Or, a remote log viewer:
170
+ .
171
+ .IP "" 4
172
+ .
173
+ .nf
174
+
175
+ ssh example\.org \'tail \-n 1000 \-f /var/log/syslog\' |bcat
176
+ .
177
+ .fi
178
+ .
179
+ .IP "" 0
180
+ .
181
+ .SS "Vim and vi Examples"
182
+ Preview current buffer as HTML:
183
+ .
184
+ .IP "" 4
185
+ .
186
+ .nf
187
+
188
+ :!markdown % |bcat
189
+ :!ronn \-5 \-\-pipe % |bcat
190
+ .
191
+ .fi
192
+ .
193
+ .IP "" 0
194
+ .
195
+ .P
196
+ Create keymappings:
197
+ .
198
+ .IP "" 4
199
+ .
200
+ .nf
201
+
202
+ map ,pm :!markdown % |bcat
203
+ map ,pp :!pygmentize \-Ofull,style=colorful \-f html % |bcat
204
+ .
205
+ .fi
206
+ .
207
+ .IP "" 0
208
+ .
209
+ .P
210
+ Use with \fBmakeprg\fR:
211
+ .
212
+ .IP "" 4
213
+ .
214
+ .nf
215
+
216
+ set makeprg=make\e \e\e\e|bcat
217
+ set makeprg=markdown\e %\e \e\e\e|bcat
218
+ set makeprg=testrb\e %\e \e\e\e|bcat
219
+ .
220
+ .fi
221
+ .
222
+ .IP "" 0
223
+ .
224
+ .SH "SEE ALSO"
225
+ cat(1), tee(1), open(1)
@@ -21,7 +21,7 @@ addition to being piped into the browser.
21
21
  immediately begins streaming input. The following options control the browser
22
22
  display:
23
23
 
24
- * `-b`, `--browser`=default|firefox|safari|chrome|opera|<other>
24
+ * `-b`, `--browser`=default|firefox|safari|chrome|opera|<other>:
25
25
  The name of the browser application. Defaults to the value of the
26
26
  `BCAT_BROWSER` environment variable, or the system default browser when
27
27
  no `BCAT_BROWSER` is defined.
@@ -70,6 +70,72 @@ Miscellaneous options:
70
70
  (`-b`) option a no-op. This should only be necessary when running a
71
71
  browser unknown to bcat or in order to pass special arguments.
72
72
 
73
+ ## EXAMPLES
74
+
75
+ ### Basic Shell Examples
76
+
77
+ With build tools:
78
+
79
+ make test |bcat
80
+ rake test |bcat
81
+
82
+ As a clipboard viewer:
83
+
84
+ pbpaste |bcat # mac
85
+ xclip -o |bcat # X11
86
+
87
+ For previewing HTML:
88
+
89
+ markdown README.md |bcat
90
+ redcloth README.textile |bcat
91
+ erb -T - template.erb |bcat
92
+ mustache < template.mustache |bcat
93
+ pygmentize -Ofull,style=colorful -f html main.c |bcat
94
+
95
+ As a simple man pager:
96
+
97
+ export MANPAGER='col -b |bcat'
98
+ man grep
99
+
100
+ With git, selectively:
101
+
102
+ git log -p --color |bcat
103
+ git diff --color HEAD@{5d} HEAD |bcat
104
+
105
+ With git, as the default PAGER:
106
+
107
+ export GIT_PAGER=bcat
108
+
109
+ git log -p
110
+ git diff HEAD@{5d} HEAD
111
+
112
+ As a log viewer:
113
+
114
+ tail -n 1000 -f log/development.log |bcat
115
+ tail -f $RAILS_ROOT/log/development.log
116
+
117
+ Or, a remote log viewer:
118
+
119
+ ssh example.org 'tail -n 1000 -f /var/log/syslog' |bcat
120
+
121
+ ### Vim and vi Examples
122
+
123
+ Preview current buffer as HTML:
124
+
125
+ :!markdown % |bcat
126
+ :!ronn -5 --pipe % |bcat
127
+
128
+ Create keymappings:
129
+
130
+ map ,pm :!markdown % |bcat
131
+ map ,pp :!pygmentize -Ofull,style=colorful -f html % |bcat
132
+
133
+ Use with `makeprg`:
134
+
135
+ set makeprg=make\ \\\|bcat
136
+ set makeprg=markdown\ %\ \\\|bcat
137
+ set makeprg=testrb\ %\ \\\|bcat
138
+
73
139
  ## SEE ALSO
74
140
 
75
141
  cat(1), tee(1), open(1)
@@ -0,0 +1,195 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>bcat -- pipe to browser utility</title>
5
+ <style>
6
+ body {
7
+ font-size:24px;
8
+ line-height:1.5;
9
+ color:#333;
10
+ }
11
+ div#index {
12
+ width:28em;
13
+ margin:0 auto;
14
+ }
15
+ h1,h2,h3,body { font-family:'gill sans','dejavu sans',verdana,sans-serif; }
16
+ tt,.aux,.man-ref,pre,h1 { font-family:menlo,'dejavu sans mono',monospace; }
17
+
18
+ h1 {
19
+ font-weight:bold;
20
+ font-size:80px;
21
+ letter-spacing:-5px;
22
+ color:#000;
23
+ margin-bottom:0;
24
+ position:relative;
25
+ left:-50px;
26
+ }
27
+ h1 b {
28
+ color:#ccc;
29
+ }
30
+ h3 {
31
+ font-weight:normal;
32
+ color:#777;
33
+ margin-top:-20px;
34
+ margin-bottom:40px;
35
+ letter-spacing:2px;
36
+ }
37
+ h4 {
38
+ font-size:26px;
39
+ color:#111;
40
+ margin-bottom:0;
41
+ }
42
+ h4+p, h4+dl { margin-top:10px }
43
+ pre {
44
+ margin-left:50px;
45
+ color:#666;
46
+ }
47
+ tt,code { font-size:0.75em; }
48
+ .aux { font-size:20px;letter-spacing:1px }
49
+ .also { font-size:20px }
50
+ .copy {
51
+ font-size:18px;
52
+ text-align:right;
53
+ color:#777;
54
+ margin-top:50px;
55
+ padding-top:5px;
56
+ border-top:1px solid #aaa;
57
+ }
58
+ .man-ref { letter-spacing:-1px; }
59
+ </style>
60
+ </head>
61
+ <body>
62
+ <div id='index'>
63
+ <h1><b>|</b>bcat</h1>
64
+ <h3>pipe to browser utility</h3>
65
+
66
+ <p class='aux'>
67
+ <a href='http://github.com/rtomayko/bcat#readme'>README</a>,
68
+ <a href='http://github.com/rtomayko/bcat/blob/master/INSTALLING#files'>INSTALLING</a>,
69
+ <a href='http://github.com/rtomayko/bcat/blob/master/COPYING#files'>COPYING</a>,
70
+ <a href='http://github.com/rtomayko/bcat/blob/master/CONTRIBUTING#files'>CONTRIBUTING</a>
71
+ </p>
72
+
73
+ <h4>Manuals</h4>
74
+ <dl>
75
+ <dt>
76
+ <a class='man-ref' href='bcat.1.html'>bcat(1)</a>,
77
+ <a class='man-ref' href='btee.1.html'>btee(1)</a>
78
+ </dt>
79
+ <dd>browser <tt>cat</tt> and browser <tt>tee</tt>.</dd>
80
+
81
+ <dt><a class='man-ref' href='a2h.1.html'>a2h(1)</a></dt>
82
+ <dd>VT100/ANSI escape sequence to HTML converter.</dd>
83
+
84
+ <!--
85
+ <dt><a class='man-ref' href='bcat-modules.7.html'>bcat-modules(7)</a></dt>
86
+ <dd>decorate bcat output with javascript and css</dd>
87
+ -->
88
+ </dl>
89
+
90
+ <h4>Examples</h4>
91
+ <p>With build tools:</p>
92
+
93
+ <pre><code>make test |bcat
94
+ rake test |bcat
95
+ </code></pre>
96
+
97
+ <p>As a clipboard viewer:</p>
98
+
99
+ <pre><code>pbpaste |bcat # macos
100
+ xclip -o |bcat # X11
101
+ </code></pre>
102
+
103
+ <p>For previewing HTML:</p>
104
+
105
+ <pre><code>markdown README.md |bcat
106
+ redcloth README.textile |bcat
107
+ erb -T - template.erb |bcat
108
+ mustache &lt; template.mustache |bcat
109
+ pygmentize -Ofull,style=colorful -f html main.c |bcat
110
+ </code></pre>
111
+
112
+ <p>As a simple man pager:</p>
113
+
114
+ <pre><code>export MANPAGER='col -b |bcat'
115
+ man grep
116
+ </code></pre>
117
+
118
+ <p>With git, selectively:</p>
119
+
120
+ <pre><code>git log -p --color |bcat
121
+ git diff --color HEAD@{5d} HEAD |bcat
122
+ </code></pre>
123
+
124
+ <p>With git, as the default PAGER:</p>
125
+
126
+ <pre><code>export GIT_PAGER=bcat
127
+ git log -p
128
+ git diff HEAD@{5d} HEAD
129
+ </code></pre>
130
+
131
+ <p>As a log viewer:</p>
132
+
133
+ <pre><code>tail -n 1000 -f log/development.log |bcat
134
+ tail -f $RAILS_ROOT/log/development.log
135
+ </code></pre>
136
+
137
+ <p>Or, a remote log viewer:</p>
138
+
139
+ <pre><code>ssh example.org 'tail -n 1000 -f /var/log/syslog' |bcat
140
+ </code></pre>
141
+
142
+ <h4>Vim and vi Examples</h4>
143
+
144
+ <p>Preview current buffer as HTML:</p>
145
+
146
+ <pre><code>:!markdown % |bcat
147
+ :!ronn -5 --pipe % |bcat
148
+ </code></pre>
149
+
150
+ <p>Create keymappings:</p>
151
+
152
+ <pre><code>:map ,pm :!markdown % |bcat
153
+ :map ,pp :!pygmentize -Ofull,style=colorful -f html % |bcat
154
+ </code></pre>
155
+
156
+ <p>Use with <code>makeprg</code>:</p>
157
+
158
+ <pre><code>:set makeprg=make\ \\\|bcat
159
+ :set makeprg=markdown\ %\ \\\|bcat
160
+ :set makeprg=testrb\ %\ \\\|bcat
161
+ </code></pre>
162
+
163
+ <h4>See Also</h4>
164
+ <ul>
165
+ <li>
166
+ <p>
167
+ Chris Wanstrath's
168
+ <a href="http://gist.github.com/318247"><tt>browser</tt></a> program
169
+ pipes standard input to a browser using a temporary file. It's many fewer
170
+ lines of code than <tt>bcat</tt>.
171
+ </p>
172
+ </li>
173
+ <li>
174
+ <p>
175
+ This excellent
176
+ <a href="http://blog.macromates.com/2005/html-output-for-commands/">
177
+ introduction to TextMate's HTML output features</a>
178
+ can be thought of as a <tt>bcat</tt> feature roadmap. It should one day
179
+ be possible to do all of those things with <tt>bcat</tt>.
180
+ </p>
181
+ </li>
182
+ <li>
183
+ <p>
184
+ <a href="http://www.uzbl.org/">uzbl</a> is a graphical web
185
+ browser (X11+gtk only) that adheres to the UNIX philosophy.
186
+ </p>
187
+ </li>
188
+ </ul>
189
+
190
+ <p class='copy'>
191
+ Copyright &copy; 2010 <a href="http://tomayko.com/about">Ryan Tomayko</a>
192
+ </p>
193
+ </div>
194
+ </body>
195
+ </html>