repl 0.1.0 → 0.2.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.
Files changed (7) hide show
  1. data/README.md +22 -4
  2. data/Rakefile +1 -1
  3. data/bin/repl +17 -3
  4. data/man/repl.1 +16 -0
  5. data/man/repl.1.html +18 -0
  6. data/man/repl.1.ron +18 -0
  7. metadata +2 -2
data/README.md CHANGED
@@ -59,6 +59,21 @@ Or even:
59
59
  Did you mean this?
60
60
  add
61
61
 
62
+ You can also use `%s` to tell repl where to stick the input:
63
+
64
+ $ repl heroku %s --app domainy
65
+ >> info
66
+ === domainy
67
+ Web URL: http://domainy.heroku.com/
68
+ Git Repo: git@heroku.com:domainy.git
69
+ Dynos: 1
70
+ Workers: 0
71
+ Repo size: 288k
72
+ Slug size: 4k
73
+ Data size: 0K in 0 table
74
+ Addons: Piggyback SSL
75
+ Owner: b****@*******.com
76
+
62
77
 
63
78
  If you have [rlwrap(1)][0] installed you'll automatically get the full
64
79
  benefits of readline: history, reverse searches, etc.
@@ -87,7 +102,7 @@ sure it's in your `$PATH`.)
87
102
 
88
103
  `repl` can also be installed as a RubyGem:
89
104
 
90
- $ gem install repl -s http://gemcutter.org/
105
+ $ gem install repl
91
106
 
92
107
 
93
108
  Completion
@@ -104,6 +119,9 @@ the `repl redis-cli` prompt.
104
119
  The directory searched for completion files can be configured using
105
120
  the `REPL_COMPLETION_DIR` environment variable.
106
121
 
122
+ See the [repl-completion](http://github.com/defunkt/repl-completion)
123
+ project for a few common, pre-rolled completion files.
124
+
107
125
 
108
126
  Configuration
109
127
  -------------
@@ -132,9 +150,9 @@ Once you've made your great commits:
132
150
  Meta
133
151
  ----
134
152
 
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>
153
+ * Code: `git clone git://github.com/defunkt/repl.git`
154
+ * Home: <http://github.com/defunkt/repl>
155
+ * Bugs: <http://github.com/defunkt/repl/issues>
138
156
  * Gems: <http://gemcutter.org/gems/repl>
139
157
 
140
158
 
data/Rakefile CHANGED
@@ -1,5 +1,5 @@
1
1
  module Repl
2
- Version = '0.1.0'
2
+ Version = '0.2.0'
3
3
  end
4
4
 
5
5
  def version
data/bin/repl CHANGED
@@ -49,9 +49,20 @@ if File.exists?(cdir = File.expand_path(completion_dir))
49
49
  end
50
50
  end
51
51
 
52
+ history_dir = ENV['REPL_HISTORY_DIR'] || "~/"
53
+ if File.exists?(hdir = File.expand_path(history_dir))
54
+ if script = ARGV.detect { |a| a !~ /^-/ }
55
+ hfile = "#{hdir}/.#{script}_history"
56
+ end
57
+ end
58
+
52
59
  if !ENV['__REPL_WRAPPED'] && system("which rlwrap > /dev/null")
53
60
  ENV['__REPL_WRAPPED'] = '0'
54
- rlargs = "-f #{cfile}" if cfile
61
+
62
+ rlargs = ""
63
+ rlargs << " -f #{cfile}" if cfile
64
+ rlargs << " -H #{hfile}" if hfile
65
+
55
66
  exec "rlwrap #{rlargs} #$0 #{ARGV.join(' ')}"
56
67
  end
57
68
 
@@ -65,6 +76,7 @@ show_help if command.empty?
65
76
  if debug
66
77
  print 'rlwrap ' if ENV['__REPL_WRAPPED']
67
78
  print "-f #{cfile} " if cfile
79
+ print "-H #{hfile} " if hfile
68
80
  puts command.inspect
69
81
  end
70
82
 
@@ -77,6 +89,8 @@ loop do
77
89
  exit
78
90
  end
79
91
 
80
- puts "$ #{command} #{line}" if debug
81
- system "#{command} #{line}"
92
+ run = "#{command} %s" % [ line, nil ]
93
+ puts "$ #{run}" if debug
94
+ system run
95
+ warn "Use Ctrl-D (i.e. EOF) to exit" if line =~ /^(exit|quit)$/
82
96
  end
data/man/repl.1 CHANGED
@@ -130,6 +130,19 @@ the \fBrepl redis\-cli\fR prompt.
130
130
  The directory searched for completion files can be configured using
131
131
  the \fBREPL_COMPLETION_DIR\fR environment variable.
132
132
  .
133
+ .SH "COMMAND HISTORY"
134
+ Because \fBrlwrap\fR supports command history, \fBrepl\fR does too. Any file in \fB~/\fR matching the name of the command you start \fBrepl\fR with prefix
135
+ with a dot and suffixed with "_history" will be used for completion.
136
+ .
137
+ .P
138
+ For instance, a file named \fB~/.redis\-cli_history\fR containing a newline
139
+ separated list of "get set info" will cause "get", "set", and "info"
140
+ to be reachable using the up arrow as command history at the \fBrepl
141
+ redis\-cli\fR prompt.
142
+ .
143
+ .P
144
+ The directory searched for history files can be configured using the\fBREPL_HISTORY_DIR\fR environment variable.
145
+ .
133
146
  .SH "ENVIRONMENT"
134
147
  .
135
148
  .SS "REPL_PROMPT"
@@ -138,6 +151,9 @@ the prompt to display before each line of input. defaults to >>
138
151
  .SS "REPL_COMPLETION_DIR"
139
152
  directory in which completion files are kept
140
153
  .
154
+ .SS "REPL_HISTORY_DIR"
155
+ directory in which command history files are kept
156
+ .
141
157
  .SH "BUGS"
142
158
  \fIhttp://github.com/defunkt/repl/issues\fR
143
159
  .
@@ -168,6 +168,20 @@ the <code>repl redis-cli</code> prompt.</p>
168
168
  <p>The directory searched for completion files can be configured using
169
169
  the <code>REPL_COMPLETION_DIR</code> environment variable.</p>
170
170
 
171
+ <h2>COMMAND HISTORY</h2>
172
+
173
+ <p>Because <code>rlwrap</code> supports command history, <code>repl</code> does too. Any file in
174
+ <code>~/</code> matching the name of the command you start <code>repl</code> with prefix
175
+ with a dot and suffixed with "_history" will be used for completion.</p>
176
+
177
+ <p>For instance, a file named <code>~/.redis-cli_history</code> containing a newline
178
+ separated list of "get set info" will cause "get", "set", and "info"
179
+ to be reachable using the up arrow as command history at the <code>repl
180
+ redis-cli</code> prompt.</p>
181
+
182
+ <p>The directory searched for history files can be configured using the
183
+ <code>REPL_HISTORY_DIR</code> environment variable.</p>
184
+
171
185
  <h2>ENVIRONMENT</h2>
172
186
 
173
187
  <h3>REPL_PROMPT</h3>
@@ -178,6 +192,10 @@ the <code>REPL_COMPLETION_DIR</code> environment variable.</p>
178
192
 
179
193
  <p>directory in which completion files are kept</p>
180
194
 
195
+ <h3>REPL_HISTORY_DIR</h3>
196
+
197
+ <p>directory in which command history files are kept</p>
198
+
181
199
  <h2>BUGS</h2>
182
200
 
183
201
  <p><a href="http://github.com/defunkt/repl/issues">http://github.com/defunkt/repl/issues</a></p>
@@ -101,6 +101,20 @@ the `repl redis-cli` prompt.
101
101
  The directory searched for completion files can be configured using
102
102
  the `REPL_COMPLETION_DIR` environment variable.
103
103
 
104
+ ## COMMAND HISTORY
105
+
106
+ Because `rlwrap` supports command history, `repl` does too. Any file in
107
+ `~/` matching the name of the command you start `repl` with prefix
108
+ with a dot and suffixed with "_history" will be used for completion.
109
+
110
+ For instance, a file named `~/.redis-cli_history` containing a newline
111
+ separated list of "get set info" will cause "get", "set", and "info"
112
+ to be reachable using the up arrow as command history at the `repl
113
+ redis-cli` prompt.
114
+
115
+ The directory searched for history files can be configured using the
116
+ `REPL_HISTORY_DIR` environment variable.
117
+
104
118
  ## ENVIRONMENT
105
119
 
106
120
  ### REPL_PROMPT
@@ -111,6 +125,10 @@ the prompt to display before each line of input. defaults to >>
111
125
 
112
126
  directory in which completion files are kept
113
127
 
128
+ ### REPL_HISTORY_DIR
129
+
130
+ directory in which command history files are kept
131
+
114
132
  ## BUGS
115
133
 
116
134
  <http://github.com/defunkt/repl/issues>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: repl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Wanstrath
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-12-12 00:00:00 -08:00
12
+ date: 2009-12-19 00:00:00 -08:00
13
13
  default_executable: repl
14
14
  dependencies: []
15
15