repl 0.1.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.
- data/LICENSE +20 -0
- data/README.md +149 -0
- data/Rakefile +59 -0
- data/bin/repl +82 -0
- data/man/repl.1 +148 -0
- data/man/repl.1.html +202 -0
- data/man/repl.1.ron +125 -0
- metadata +62 -0
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2009 Chris Wanstrath
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,149 @@
|
|
1
|
+
repl(1) -- sometimes you need a repl
|
2
|
+
====================================
|
3
|
+
|
4
|
+
`repl` is an interactive program which tenderly wraps another,
|
5
|
+
non-interactive program.
|
6
|
+
|
7
|
+
For example:
|
8
|
+
|
9
|
+
$ repl redis-cli -p 6665
|
10
|
+
>> set name chris
|
11
|
+
OK
|
12
|
+
>> get name
|
13
|
+
chris
|
14
|
+
>> info
|
15
|
+
redis_version:1.000
|
16
|
+
uptime_in_seconds:182991
|
17
|
+
uptime_in_days:2
|
18
|
+
.. etc ..
|
19
|
+
|
20
|
+
|
21
|
+
Or:
|
22
|
+
|
23
|
+
$ repl gem
|
24
|
+
>> --version
|
25
|
+
1.3.5
|
26
|
+
>> search yajl
|
27
|
+
|
28
|
+
*** LOCAL GEMS ***
|
29
|
+
|
30
|
+
yajl-ruby (0.6.7)
|
31
|
+
>> search yajl -r
|
32
|
+
|
33
|
+
*** REMOTE GEMS ***
|
34
|
+
|
35
|
+
brianmario-yajl-ruby (0.6.3)
|
36
|
+
filipegiusti-yajl-ruby (0.6.4)
|
37
|
+
jdg-yajl-ruby (0.5.12)
|
38
|
+
oortle-yajl-ruby (0.5.8)
|
39
|
+
yajl-ruby (0.6.7)
|
40
|
+
|
41
|
+
|
42
|
+
Or even:
|
43
|
+
|
44
|
+
$ repl git
|
45
|
+
>> branch
|
46
|
+
gh-pages
|
47
|
+
* master
|
48
|
+
>> tag
|
49
|
+
rm
|
50
|
+
v0.1.0
|
51
|
+
v0.1.1
|
52
|
+
v0.1.2
|
53
|
+
v0.1.3
|
54
|
+
>> tag -d rm
|
55
|
+
Deleted tag 'rm'
|
56
|
+
>> pwd
|
57
|
+
git: 'pwd' is not a git-command. See 'git --help'.
|
58
|
+
|
59
|
+
Did you mean this?
|
60
|
+
add
|
61
|
+
|
62
|
+
|
63
|
+
If you have [rlwrap(1)][0] installed you'll automatically get the full
|
64
|
+
benefits of readline: history, reverse searches, etc.
|
65
|
+
|
66
|
+
`repl` is meant to wrap programs which accept command line arguments
|
67
|
+
and print to the standard output. It keeps no state between executed
|
68
|
+
lines and, as such, cannot be used to replace `irb` or the Python
|
69
|
+
REPL (for example).
|
70
|
+
|
71
|
+
|
72
|
+
Install
|
73
|
+
-------
|
74
|
+
|
75
|
+
### Standalone
|
76
|
+
|
77
|
+
`repl` is easily installed as a standalone script:
|
78
|
+
|
79
|
+
export REPL_BIN=~/bin/repl
|
80
|
+
curl -s http://github.com/defunkt/repl/raw/latest/bin/repl > $REPL_BIN
|
81
|
+
chmod 755 $REPL_BIN
|
82
|
+
|
83
|
+
Change `$REPL_BIN` to your desired location and have at! (Just make
|
84
|
+
sure it's in your `$PATH`.)
|
85
|
+
|
86
|
+
### RubyGems
|
87
|
+
|
88
|
+
`repl` can also be installed as a RubyGem:
|
89
|
+
|
90
|
+
$ gem install repl -s http://gemcutter.org/
|
91
|
+
|
92
|
+
|
93
|
+
Completion
|
94
|
+
----------
|
95
|
+
|
96
|
+
Because `rlwrap` supports completion, `repl` does too. Any file in
|
97
|
+
`~/.repl` matching the name of the command you start `repl` with will
|
98
|
+
be used for completion.
|
99
|
+
|
100
|
+
For instance, a file named `~/.repl/redis-cli` containing "get set
|
101
|
+
info" will cause "get", "set", and "info" to be tab completeable at
|
102
|
+
the `repl redis-cli` prompt.
|
103
|
+
|
104
|
+
The directory searched for completion files can be configured using
|
105
|
+
the `REPL_COMPLETION_DIR` environment variable.
|
106
|
+
|
107
|
+
|
108
|
+
Configuration
|
109
|
+
-------------
|
110
|
+
|
111
|
+
The following environment variables affect `repl`'s behavior:
|
112
|
+
|
113
|
+
`REPL_PROMPT`:
|
114
|
+
the prompt to display before each line of input. defaults to >>
|
115
|
+
|
116
|
+
`REPL_COMPLETION_DIR`:
|
117
|
+
directory in which completion files are kept
|
118
|
+
|
119
|
+
|
120
|
+
Contributing
|
121
|
+
------------
|
122
|
+
|
123
|
+
Once you've made your great commits:
|
124
|
+
|
125
|
+
1. [Fork][1] repl
|
126
|
+
2. Create a topic branch - `git checkout -b my_branch`
|
127
|
+
3. Push to your branch - `git push origin my_branch`
|
128
|
+
4. Create an [Issue][2] with a link to your branch
|
129
|
+
5. That's it!
|
130
|
+
|
131
|
+
|
132
|
+
Meta
|
133
|
+
----
|
134
|
+
|
135
|
+
* Code: `git clone git://gitrepl.com/defunkt/repl.git`
|
136
|
+
* Home: <http://gitrepl.com/defunkt/repl>
|
137
|
+
* Bugs: <http://gitrepl.com/defunkt/repl/issues>
|
138
|
+
* Gems: <http://gemcutter.org/gems/repl>
|
139
|
+
|
140
|
+
|
141
|
+
Author
|
142
|
+
------
|
143
|
+
|
144
|
+
Chris Wanstrath :: chris@ozmm.org :: @defunkt
|
145
|
+
|
146
|
+
|
147
|
+
[0]: http://utopia.knoware.nl/~hlub/rlwrap/
|
148
|
+
[1]: http://help.github.com/forking/
|
149
|
+
[2]: http://github.com/defunkt/repl/issues
|
data/Rakefile
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
module Repl
|
2
|
+
Version = '0.1.0'
|
3
|
+
end
|
4
|
+
|
5
|
+
def version
|
6
|
+
Repl::Version
|
7
|
+
end
|
8
|
+
|
9
|
+
def git(command)
|
10
|
+
system("git #{command}")
|
11
|
+
end
|
12
|
+
|
13
|
+
|
14
|
+
begin
|
15
|
+
require 'jeweler'
|
16
|
+
Jeweler::Tasks.new do |gemspec|
|
17
|
+
gemspec.name = "repl"
|
18
|
+
gemspec.summary = gemspec.description = "repl tenderly wraps another program"
|
19
|
+
gemspec.homepage = "http://github.com/defunkt/repl"
|
20
|
+
gemspec.version = version
|
21
|
+
gemspec.authors = ["Chris Wanstrath"]
|
22
|
+
gemspec.email = "chris@ozmm.org"
|
23
|
+
end
|
24
|
+
rescue LoadError
|
25
|
+
puts "Jeweler not available."
|
26
|
+
puts "Install it with: gem install jeweler"
|
27
|
+
end
|
28
|
+
|
29
|
+
desc "Build manual"
|
30
|
+
task :build_man do
|
31
|
+
sh "ron -br5 --organization=DEFUNKT man/*.ron"
|
32
|
+
end
|
33
|
+
|
34
|
+
desc "Build and show manual"
|
35
|
+
task :man => :build_man do
|
36
|
+
exec "man man/repl.1"
|
37
|
+
end
|
38
|
+
|
39
|
+
desc "Push a new version to Gemcutter"
|
40
|
+
task :publish => [ :gemspec, :build ] do
|
41
|
+
git "tag v#{version}"
|
42
|
+
git "push origin v#{version}"
|
43
|
+
git "push origin master"
|
44
|
+
git "push origin master:latest"
|
45
|
+
system "gem push pkg/repl-#{version}.gem"
|
46
|
+
git "clean -fd"
|
47
|
+
exec "rake pages"
|
48
|
+
end
|
49
|
+
|
50
|
+
desc "Publish to GitHub Pages"
|
51
|
+
task :pages => [ :build_man ] do
|
52
|
+
cp "man/repl.1.html", "html"
|
53
|
+
git "checkout gh-pages"
|
54
|
+
mv "html", "index.html"
|
55
|
+
git "commit -a -m 'update docs'"
|
56
|
+
git "push origin gh-pages"
|
57
|
+
git "checkout master"
|
58
|
+
puts :done
|
59
|
+
end
|
data/bin/repl
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# repl(1) -- sometimes you need a repl
|
4
|
+
#
|
5
|
+
# repl is an interactive program which tenderly wraps another,
|
6
|
+
# non-interactive program.
|
7
|
+
#
|
8
|
+
# For example:
|
9
|
+
#
|
10
|
+
# $ repl redis-cli
|
11
|
+
# >> set name chris
|
12
|
+
# OK
|
13
|
+
# >> get name
|
14
|
+
# chris
|
15
|
+
#
|
16
|
+
# If you have rlwrap(1) installed you'll get the full benefits of
|
17
|
+
# readline: history, reverse searches, etc.
|
18
|
+
|
19
|
+
def show_help
|
20
|
+
puts <<-help
|
21
|
+
Usage: repl [options] command ...
|
22
|
+
|
23
|
+
Options:
|
24
|
+
--help Display this message
|
25
|
+
--debug Display each command executed
|
26
|
+
--man Display the man page
|
27
|
+
|
28
|
+
Bug reports, suggestions, updates:
|
29
|
+
http://http://github.com/defunkt/repl/issues
|
30
|
+
help
|
31
|
+
exit
|
32
|
+
end
|
33
|
+
|
34
|
+
if ARGV.empty? || ARGV.any? { |arg| %w( -h --help -help help ).include?(arg) }
|
35
|
+
show_help
|
36
|
+
end
|
37
|
+
|
38
|
+
if ARGV.include? '--man'
|
39
|
+
dir = File.dirname(__FILE__)
|
40
|
+
exec "man #{dir}/../man/repl.1"
|
41
|
+
end
|
42
|
+
|
43
|
+
completion_dir = ENV['REPL_COMPLETION_DIR'] || "~/.repl"
|
44
|
+
if File.exists?(cdir = File.expand_path(completion_dir))
|
45
|
+
script = ARGV.detect { |a| a !~ /^-/ }
|
46
|
+
if script
|
47
|
+
cfile = Dir[cdir + '/' + script].first
|
48
|
+
cfile = nil if cfile && !File.exists?(cfile)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
if !ENV['__REPL_WRAPPED'] && system("which rlwrap > /dev/null")
|
53
|
+
ENV['__REPL_WRAPPED'] = '0'
|
54
|
+
rlargs = "-f #{cfile}" if cfile
|
55
|
+
exec "rlwrap #{rlargs} #$0 #{ARGV.join(' ')}"
|
56
|
+
end
|
57
|
+
|
58
|
+
if ARGV[0] == '--debug'
|
59
|
+
debug = ARGV.delete('--debug')
|
60
|
+
end
|
61
|
+
|
62
|
+
command = ARGV.join(' ')
|
63
|
+
show_help if command.empty?
|
64
|
+
|
65
|
+
if debug
|
66
|
+
print 'rlwrap ' if ENV['__REPL_WRAPPED']
|
67
|
+
print "-f #{cfile} " if cfile
|
68
|
+
puts command.inspect
|
69
|
+
end
|
70
|
+
|
71
|
+
loop do
|
72
|
+
print ENV['REPL_PROMPT'] || '>> '
|
73
|
+
|
74
|
+
begin
|
75
|
+
line = $stdin.gets.chomp
|
76
|
+
rescue NoMethodError, Interrupt
|
77
|
+
exit
|
78
|
+
end
|
79
|
+
|
80
|
+
puts "$ #{command} #{line}" if debug
|
81
|
+
system "#{command} #{line}"
|
82
|
+
end
|
data/man/repl.1
ADDED
@@ -0,0 +1,148 @@
|
|
1
|
+
.\" generated with Ron/v0.3
|
2
|
+
.\" http://github.com/rtomayko/ron/
|
3
|
+
.
|
4
|
+
.TH "REPL" "1" "December 2009" "DEFUNKT" ""
|
5
|
+
.
|
6
|
+
.SH "NAME"
|
7
|
+
\fBrepl\fR \-\- sometimes you need a repl
|
8
|
+
.
|
9
|
+
.SH "SYNOPSIS"
|
10
|
+
\fBrepl\fR \fI[repl\-options]\fR \fIcommand\fR <...>
|
11
|
+
.
|
12
|
+
.SH "DESCRIPTION"
|
13
|
+
\fBrepl\fR wraps a non\-interactive \fBcommand\fR in an interactive
|
14
|
+
read\-eval\-print\-loop prompt. Each line you type into the prompt is
|
15
|
+
executed as arguments to \fBcommand\fR. Anything written to standard
|
16
|
+
output or standard error by the \fBcommand\fR is displayed.
|
17
|
+
.
|
18
|
+
.P
|
19
|
+
If you have \fBrlwrap(1)\fR installed you'll automatically get the full
|
20
|
+
benefits of readline: history, reverse searches, etc.
|
21
|
+
.
|
22
|
+
.P
|
23
|
+
\fBrepl\fR is meant to wrap programs which accept command line arguments
|
24
|
+
and print to the standard output. It keeps no state between executed
|
25
|
+
lines and, as such, cannot be used to replace \fBirb\fR or the Python
|
26
|
+
REPL (for example).
|
27
|
+
.
|
28
|
+
.SH "EXAMPLES"
|
29
|
+
Using \fBrepl\fR with \fBredis\-cli\fR:
|
30
|
+
.
|
31
|
+
.IP "" 4
|
32
|
+
.
|
33
|
+
.nf
|
34
|
+
|
35
|
+
$ repl redis\-cli
|
36
|
+
>> set name chris
|
37
|
+
OK
|
38
|
+
>> get name
|
39
|
+
chris
|
40
|
+
>> info
|
41
|
+
redis_version:1.000
|
42
|
+
uptime_in_seconds:182991
|
43
|
+
uptime_in_days:2
|
44
|
+
.. etc ..
|
45
|
+
.
|
46
|
+
.fi
|
47
|
+
.
|
48
|
+
.IP "" 0
|
49
|
+
.
|
50
|
+
.P
|
51
|
+
Using \fBrepl\fR with Ruby's \fBgem\fR:
|
52
|
+
.
|
53
|
+
.IP "" 4
|
54
|
+
.
|
55
|
+
.nf
|
56
|
+
|
57
|
+
$ repl gem
|
58
|
+
>> \-\-version
|
59
|
+
1.3.5
|
60
|
+
>> search yajl
|
61
|
+
*** LOCAL GEMS ***
|
62
|
+
|
63
|
+
yajl\-ruby (0.6.7)
|
64
|
+
>> search yajl \-r
|
65
|
+
|
66
|
+
*** REMOTE GEMS ***
|
67
|
+
|
68
|
+
brianmario\-yajl\-ruby (0.6.3)
|
69
|
+
filipegiusti\-yajl\-ruby (0.6.4)
|
70
|
+
jdg\-yajl\-ruby (0.5.12)
|
71
|
+
oortle\-yajl\-ruby (0.5.8)
|
72
|
+
yajl\-ruby (0.6.7)
|
73
|
+
.
|
74
|
+
.fi
|
75
|
+
.
|
76
|
+
.IP "" 0
|
77
|
+
.
|
78
|
+
.P
|
79
|
+
Using \fBrepl\fR with \fBgit\fR:
|
80
|
+
.
|
81
|
+
.IP "" 4
|
82
|
+
.
|
83
|
+
.nf
|
84
|
+
|
85
|
+
$ repl git
|
86
|
+
>> branch
|
87
|
+
gh\-pages
|
88
|
+
* master
|
89
|
+
>> tag
|
90
|
+
rm
|
91
|
+
v0.1.0
|
92
|
+
v0.1.1
|
93
|
+
v0.1.2
|
94
|
+
v0.1.3
|
95
|
+
>> tag \-d rm
|
96
|
+
Deleted tag 'rm'
|
97
|
+
>> pwd
|
98
|
+
git: 'pwd' is not a git\-command. See 'git \-\-help'.
|
99
|
+
Did you mean this?
|
100
|
+
add
|
101
|
+
.
|
102
|
+
.fi
|
103
|
+
.
|
104
|
+
.IP "" 0
|
105
|
+
.
|
106
|
+
.SH "OPTIONS"
|
107
|
+
.
|
108
|
+
.TP
|
109
|
+
\fB\-h\fR, \fB\-\-help\fR
|
110
|
+
Displays usage information.
|
111
|
+
.
|
112
|
+
.TP
|
113
|
+
\fB\-\-debug\fR
|
114
|
+
Displays debug information while running.
|
115
|
+
.
|
116
|
+
.TP
|
117
|
+
\fB\-\-man\fR
|
118
|
+
Displays this man page.
|
119
|
+
.
|
120
|
+
.SH "COMPLETION"
|
121
|
+
Because \fBrlwrap\fR supports completion, \fBrepl\fR does too. Any file in \fB~/.repl\fR matching the name of the command you start \fBrepl\fR with will
|
122
|
+
be used for completion.
|
123
|
+
.
|
124
|
+
.P
|
125
|
+
For instance, a file named \fB~/.repl/redis\-cli\fR containing "get set
|
126
|
+
info" will cause "get", "set", and "info" to be tab completeable at
|
127
|
+
the \fBrepl redis\-cli\fR prompt.
|
128
|
+
.
|
129
|
+
.P
|
130
|
+
The directory searched for completion files can be configured using
|
131
|
+
the \fBREPL_COMPLETION_DIR\fR environment variable.
|
132
|
+
.
|
133
|
+
.SH "ENVIRONMENT"
|
134
|
+
.
|
135
|
+
.SS "REPL_PROMPT"
|
136
|
+
the prompt to display before each line of input. defaults to >>
|
137
|
+
.
|
138
|
+
.SS "REPL_COMPLETION_DIR"
|
139
|
+
directory in which completion files are kept
|
140
|
+
.
|
141
|
+
.SH "BUGS"
|
142
|
+
\fIhttp://github.com/defunkt/repl/issues\fR
|
143
|
+
.
|
144
|
+
.SH "AUTHOR"
|
145
|
+
Chris Wanstrath :: chris@ozmm.org :: @defunkt
|
146
|
+
.
|
147
|
+
.SH "SEE ALSO"
|
148
|
+
rlwrap(1), readline(3), \fIhttp://github.com\fR, \fIhttp://github.com/defunkt/repl\fR
|
data/man/repl.1.html
ADDED
@@ -0,0 +1,202 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta http-equiv='content-type' value='text/html;charset=utf8'>
|
5
|
+
<meta name='generator' value='Ron/v0.3'>
|
6
|
+
<title>repl(1) -- sometimes you need a repl</title>
|
7
|
+
<style type='text/css'>
|
8
|
+
body {margin:0}
|
9
|
+
#man, #man code, #man pre, #man tt, #man kbd, #man samp {
|
10
|
+
font-family:consolas,monospace;
|
11
|
+
font-size:16px;
|
12
|
+
line-height:1.3;
|
13
|
+
color:#343331;
|
14
|
+
background:#fff; }
|
15
|
+
#man { max-width:89ex; text-align:justify; margin:0 25px 25px 25px }
|
16
|
+
#man h1, #man h2, #man h3 { color:#232221;clear:left }
|
17
|
+
#man h1 { font-size:28px; margin:15px 0 30px 0; text-align:center }
|
18
|
+
#man h2 { font-size:18px; margin-bottom:0; margin-top:10px; line-height:1.3; }
|
19
|
+
#man h3 { font-size:16px; margin:0 0 0 4ex; }
|
20
|
+
#man p, #man ul, #man ol, #man dl, #man pre { margin:0 0 18px 0; }
|
21
|
+
#man pre {
|
22
|
+
color:#333231;
|
23
|
+
background:#edeceb;
|
24
|
+
padding:5px 7px;
|
25
|
+
margin:0px 0 20px 0;
|
26
|
+
border-left:2ex solid #ddd}
|
27
|
+
#man pre + h2, #man pre + h3 {
|
28
|
+
margin-top:22px;
|
29
|
+
}
|
30
|
+
#man h2 + pre, #man h3 + pre {
|
31
|
+
margin-top:5px;
|
32
|
+
}
|
33
|
+
#man > p, #man > ul, #man > ol, #man > dl, #man > pre { margin-left:8ex; }
|
34
|
+
#man dt { margin:0; clear:left }
|
35
|
+
#man dt.flush { float:left; width:8ex }
|
36
|
+
#man dd { margin:0 0 0 9ex }
|
37
|
+
#man code, #man strong, #man b { font-weight:bold; color:#131211; }
|
38
|
+
#man pre code { font-weight:normal; color:#232221; background:inherit }
|
39
|
+
#man em, var, u {
|
40
|
+
font-style:normal; color:#333231; border-bottom:1px solid #999; }
|
41
|
+
#man h1.man-title { display:none; }
|
42
|
+
#man ol.man, #man ol.man li { margin:2px 0 10px 0; padding:0;
|
43
|
+
float:left; width:33%; list-style-type:none;
|
44
|
+
text-transform:uppercase; font-size:18px; color:#999;
|
45
|
+
letter-spacing:1px;}
|
46
|
+
#man ol.man { width:100%; }
|
47
|
+
#man ol.man li.tl { text-align:left }
|
48
|
+
#man ol.man li.tc { text-align:center;letter-spacing:4px }
|
49
|
+
#man ol.man li.tr { text-align:right }
|
50
|
+
#man ol.man a { color:#999 }
|
51
|
+
#man ol.man a:hover { color:#333231 }
|
52
|
+
</style>
|
53
|
+
</head>
|
54
|
+
<body>
|
55
|
+
<div id='man'>
|
56
|
+
|
57
|
+
<h1 class='man-title'>repl(1)</h1>
|
58
|
+
|
59
|
+
<ol class='head man'>
|
60
|
+
<li class='tl'>repl(1)</li>
|
61
|
+
<li class='tc'></li>
|
62
|
+
<li class='tr'>repl(1)</li>
|
63
|
+
</ol>
|
64
|
+
|
65
|
+
<h2 id='NAME'>NAME</h2>
|
66
|
+
<p><code>repl</code> -- sometimes you need a repl</p>
|
67
|
+
<h2>SYNOPSIS</h2>
|
68
|
+
|
69
|
+
<p><code>repl</code> <var>[repl-options]</var> <var>command</var> <...></p>
|
70
|
+
|
71
|
+
<h2>DESCRIPTION</h2>
|
72
|
+
|
73
|
+
<p><code>repl</code> wraps a non-interactive <code>command</code> in an interactive
|
74
|
+
read-eval-print-loop prompt. Each line you type into the prompt is
|
75
|
+
executed as arguments to <code>command</code>. Anything written to standard
|
76
|
+
output or standard error by the <code>command</code> is displayed.</p>
|
77
|
+
|
78
|
+
<p>If you have <code>rlwrap(1)</code> installed you'll automatically get the full
|
79
|
+
benefits of readline: history, reverse searches, etc.</p>
|
80
|
+
|
81
|
+
<p><code>repl</code> is meant to wrap programs which accept command line arguments
|
82
|
+
and print to the standard output. It keeps no state between executed
|
83
|
+
lines and, as such, cannot be used to replace <code>irb</code> or the Python
|
84
|
+
REPL (for example).</p>
|
85
|
+
|
86
|
+
<h2>EXAMPLES</h2>
|
87
|
+
|
88
|
+
<p>Using <code>repl</code> with <code>redis-cli</code>:</p>
|
89
|
+
|
90
|
+
<pre><code>$ repl redis-cli
|
91
|
+
>> set name chris
|
92
|
+
OK
|
93
|
+
>> get name
|
94
|
+
chris
|
95
|
+
>> info
|
96
|
+
redis_version:1.000
|
97
|
+
uptime_in_seconds:182991
|
98
|
+
uptime_in_days:2
|
99
|
+
.. etc ..
|
100
|
+
</code></pre>
|
101
|
+
|
102
|
+
<p>Using <code>repl</code> with Ruby's <code>gem</code>:</p>
|
103
|
+
|
104
|
+
<pre><code>$ repl gem
|
105
|
+
>> --version
|
106
|
+
1.3.5
|
107
|
+
>> search yajl
|
108
|
+
|
109
|
+
*** LOCAL GEMS ***
|
110
|
+
|
111
|
+
yajl-ruby (0.6.7)
|
112
|
+
>> search yajl -r
|
113
|
+
|
114
|
+
*** REMOTE GEMS ***
|
115
|
+
|
116
|
+
brianmario-yajl-ruby (0.6.3)
|
117
|
+
filipegiusti-yajl-ruby (0.6.4)
|
118
|
+
jdg-yajl-ruby (0.5.12)
|
119
|
+
oortle-yajl-ruby (0.5.8)
|
120
|
+
yajl-ruby (0.6.7)
|
121
|
+
</code></pre>
|
122
|
+
|
123
|
+
<p>Using <code>repl</code> with <code>git</code>:</p>
|
124
|
+
|
125
|
+
<pre><code>$ repl git
|
126
|
+
>> branch
|
127
|
+
gh-pages
|
128
|
+
* master
|
129
|
+
>> tag
|
130
|
+
rm
|
131
|
+
v0.1.0
|
132
|
+
v0.1.1
|
133
|
+
v0.1.2
|
134
|
+
v0.1.3
|
135
|
+
>> tag -d rm
|
136
|
+
Deleted tag 'rm'
|
137
|
+
>> pwd
|
138
|
+
git: 'pwd' is not a git-command. See 'git --help'.
|
139
|
+
|
140
|
+
Did you mean this?
|
141
|
+
add
|
142
|
+
</code></pre>
|
143
|
+
|
144
|
+
<h2>OPTIONS</h2>
|
145
|
+
|
146
|
+
<dl>
|
147
|
+
<dt>
|
148
|
+
<code>-h</code>, <code>--help</code>
|
149
|
+
</dt>
|
150
|
+
<dd><p>Displays usage information.</p></dd>
|
151
|
+
<dt class="flush"><code>--debug</code></dt>
|
152
|
+
<dd><p>Displays debug information while running.</p></dd>
|
153
|
+
<dt class="flush"><code>--man</code></dt>
|
154
|
+
<dd><p>Displays this man page.</p></dd>
|
155
|
+
</dl>
|
156
|
+
|
157
|
+
|
158
|
+
<h2>COMPLETION</h2>
|
159
|
+
|
160
|
+
<p>Because <code>rlwrap</code> supports completion, <code>repl</code> does too. Any file in
|
161
|
+
<code>~/.repl</code> matching the name of the command you start <code>repl</code> with will
|
162
|
+
be used for completion.</p>
|
163
|
+
|
164
|
+
<p>For instance, a file named <code>~/.repl/redis-cli</code> containing "get set
|
165
|
+
info" will cause "get", "set", and "info" to be tab completeable at
|
166
|
+
the <code>repl redis-cli</code> prompt.</p>
|
167
|
+
|
168
|
+
<p>The directory searched for completion files can be configured using
|
169
|
+
the <code>REPL_COMPLETION_DIR</code> environment variable.</p>
|
170
|
+
|
171
|
+
<h2>ENVIRONMENT</h2>
|
172
|
+
|
173
|
+
<h3>REPL_PROMPT</h3>
|
174
|
+
|
175
|
+
<p>the prompt to display before each line of input. defaults to >></p>
|
176
|
+
|
177
|
+
<h3>REPL_COMPLETION_DIR</h3>
|
178
|
+
|
179
|
+
<p>directory in which completion files are kept</p>
|
180
|
+
|
181
|
+
<h2>BUGS</h2>
|
182
|
+
|
183
|
+
<p><a href="http://github.com/defunkt/repl/issues">http://github.com/defunkt/repl/issues</a></p>
|
184
|
+
|
185
|
+
<h2>AUTHOR</h2>
|
186
|
+
|
187
|
+
<p>Chris Wanstrath :: chris@ozmm.org :: @defunkt</p>
|
188
|
+
|
189
|
+
<h2>SEE ALSO</h2>
|
190
|
+
|
191
|
+
<p>rlwrap(1), readline(3), <a href="http://github.com">http://github.com</a>,
|
192
|
+
<a href="http://github.com/defunkt/repl">http://github.com/defunkt/repl</a></p>
|
193
|
+
|
194
|
+
<ol class='foot man'>
|
195
|
+
<li class='tl'>DEFUNKT</li>
|
196
|
+
<li class='tc'>December 2009</li>
|
197
|
+
<li class='tr'>repl(1)</li>
|
198
|
+
</ol>
|
199
|
+
|
200
|
+
</div>
|
201
|
+
</body>
|
202
|
+
</html>
|
data/man/repl.1.ron
ADDED
@@ -0,0 +1,125 @@
|
|
1
|
+
repl(1) - sometimes you need a repl
|
2
|
+
===================================
|
3
|
+
|
4
|
+
## SYNOPSIS
|
5
|
+
|
6
|
+
`repl` <[repl-options]> <command> <...>
|
7
|
+
|
8
|
+
## DESCRIPTION
|
9
|
+
|
10
|
+
`repl` wraps a non-interactive `command` in an interactive
|
11
|
+
read-eval-print-loop prompt. Each line you type into the prompt is
|
12
|
+
executed as arguments to `command`. Anything written to standard
|
13
|
+
output or standard error by the `command` is displayed.
|
14
|
+
|
15
|
+
If you have `rlwrap(1)` installed you'll automatically get the full
|
16
|
+
benefits of readline: history, reverse searches, etc.
|
17
|
+
|
18
|
+
`repl` is meant to wrap programs which accept command line arguments
|
19
|
+
and print to the standard output. It keeps no state between executed
|
20
|
+
lines and, as such, cannot be used to replace `irb` or the Python
|
21
|
+
REPL (for example).
|
22
|
+
|
23
|
+
## EXAMPLES
|
24
|
+
|
25
|
+
Using `repl` with `redis-cli`:
|
26
|
+
|
27
|
+
$ repl redis-cli
|
28
|
+
>> set name chris
|
29
|
+
OK
|
30
|
+
>> get name
|
31
|
+
chris
|
32
|
+
>> info
|
33
|
+
redis_version:1.000
|
34
|
+
uptime_in_seconds:182991
|
35
|
+
uptime_in_days:2
|
36
|
+
.. etc ..
|
37
|
+
|
38
|
+
|
39
|
+
Using `repl` with Ruby's `gem`:
|
40
|
+
|
41
|
+
$ repl gem
|
42
|
+
>> --version
|
43
|
+
1.3.5
|
44
|
+
>> search yajl
|
45
|
+
|
46
|
+
*** LOCAL GEMS ***
|
47
|
+
|
48
|
+
yajl-ruby (0.6.7)
|
49
|
+
>> search yajl -r
|
50
|
+
|
51
|
+
*** REMOTE GEMS ***
|
52
|
+
|
53
|
+
brianmario-yajl-ruby (0.6.3)
|
54
|
+
filipegiusti-yajl-ruby (0.6.4)
|
55
|
+
jdg-yajl-ruby (0.5.12)
|
56
|
+
oortle-yajl-ruby (0.5.8)
|
57
|
+
yajl-ruby (0.6.7)
|
58
|
+
|
59
|
+
|
60
|
+
Using `repl` with `git`:
|
61
|
+
|
62
|
+
$ repl git
|
63
|
+
>> branch
|
64
|
+
gh-pages
|
65
|
+
* master
|
66
|
+
>> tag
|
67
|
+
rm
|
68
|
+
v0.1.0
|
69
|
+
v0.1.1
|
70
|
+
v0.1.2
|
71
|
+
v0.1.3
|
72
|
+
>> tag -d rm
|
73
|
+
Deleted tag 'rm'
|
74
|
+
>> pwd
|
75
|
+
git: 'pwd' is not a git-command. See 'git --help'.
|
76
|
+
|
77
|
+
Did you mean this?
|
78
|
+
add
|
79
|
+
|
80
|
+
## OPTIONS
|
81
|
+
|
82
|
+
* `-h`, `--help`:
|
83
|
+
Displays usage information.
|
84
|
+
|
85
|
+
* `--debug`:
|
86
|
+
Displays debug information while running.
|
87
|
+
|
88
|
+
* `--man`:
|
89
|
+
Displays this man page.
|
90
|
+
|
91
|
+
## COMPLETION
|
92
|
+
|
93
|
+
Because `rlwrap` supports completion, `repl` does too. Any file in
|
94
|
+
`~/.repl` matching the name of the command you start `repl` with will
|
95
|
+
be used for completion.
|
96
|
+
|
97
|
+
For instance, a file named `~/.repl/redis-cli` containing "get set
|
98
|
+
info" will cause "get", "set", and "info" to be tab completeable at
|
99
|
+
the `repl redis-cli` prompt.
|
100
|
+
|
101
|
+
The directory searched for completion files can be configured using
|
102
|
+
the `REPL_COMPLETION_DIR` environment variable.
|
103
|
+
|
104
|
+
## ENVIRONMENT
|
105
|
+
|
106
|
+
### REPL_PROMPT
|
107
|
+
|
108
|
+
the prompt to display before each line of input. defaults to >>
|
109
|
+
|
110
|
+
### REPL_COMPLETION_DIR
|
111
|
+
|
112
|
+
directory in which completion files are kept
|
113
|
+
|
114
|
+
## BUGS
|
115
|
+
|
116
|
+
<http://github.com/defunkt/repl/issues>
|
117
|
+
|
118
|
+
## AUTHOR
|
119
|
+
|
120
|
+
Chris Wanstrath :: chris@ozmm.org :: @defunkt
|
121
|
+
|
122
|
+
## SEE ALSO
|
123
|
+
|
124
|
+
rlwrap(1), readline(3), <http://github.com>,
|
125
|
+
<http://github.com/defunkt/repl>
|
metadata
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: repl
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Chris Wanstrath
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-12-12 00:00:00 -08:00
|
13
|
+
default_executable: repl
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description: repl tenderly wraps another program
|
17
|
+
email: chris@ozmm.org
|
18
|
+
executables:
|
19
|
+
- repl
|
20
|
+
extensions: []
|
21
|
+
|
22
|
+
extra_rdoc_files:
|
23
|
+
- LICENSE
|
24
|
+
- README.md
|
25
|
+
files:
|
26
|
+
- LICENSE
|
27
|
+
- README.md
|
28
|
+
- Rakefile
|
29
|
+
- bin/repl
|
30
|
+
- man/repl.1
|
31
|
+
- man/repl.1.html
|
32
|
+
- man/repl.1.ron
|
33
|
+
has_rdoc: true
|
34
|
+
homepage: http://github.com/defunkt/repl
|
35
|
+
licenses: []
|
36
|
+
|
37
|
+
post_install_message:
|
38
|
+
rdoc_options:
|
39
|
+
- --charset=UTF-8
|
40
|
+
require_paths:
|
41
|
+
- lib
|
42
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: "0"
|
47
|
+
version:
|
48
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
50
|
+
- - ">="
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: "0"
|
53
|
+
version:
|
54
|
+
requirements: []
|
55
|
+
|
56
|
+
rubyforge_project:
|
57
|
+
rubygems_version: 1.3.5
|
58
|
+
signing_key:
|
59
|
+
specification_version: 3
|
60
|
+
summary: repl tenderly wraps another program
|
61
|
+
test_files: []
|
62
|
+
|