repl 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (6) hide show
  1. data/Rakefile +1 -1
  2. data/bin/repl +13 -3
  3. data/man/repl.1 +5 -1
  4. data/man/repl.1.html +3 -1
  5. data/man/repl.1.ron +3 -0
  6. metadata +2 -2
data/Rakefile CHANGED
@@ -1,5 +1,5 @@
1
1
  module Repl
2
- Version = '0.2.0'
2
+ Version = '0.2.1'
3
3
  end
4
4
 
5
5
  def version
data/bin/repl CHANGED
@@ -22,6 +22,7 @@ Usage: repl [options] command ...
22
22
 
23
23
  Options:
24
24
  --help Display this message
25
+ --stdin Pipe input to command's STDIN
25
26
  --debug Display each command executed
26
27
  --man Display the man page
27
28
 
@@ -44,7 +45,7 @@ completion_dir = ENV['REPL_COMPLETION_DIR'] || "~/.repl"
44
45
  if File.exists?(cdir = File.expand_path(completion_dir))
45
46
  script = ARGV.detect { |a| a !~ /^-/ }
46
47
  if script
47
- cfile = Dir[cdir + '/' + script].first
48
+ cfile = Dir[cdir + '/' + File.basename(script)].first
48
49
  cfile = nil if cfile && !File.exists?(cfile)
49
50
  end
50
51
  end
@@ -52,11 +53,12 @@ end
52
53
  history_dir = ENV['REPL_HISTORY_DIR'] || "~/"
53
54
  if File.exists?(hdir = File.expand_path(history_dir))
54
55
  if script = ARGV.detect { |a| a !~ /^-/ }
56
+ script = File.basename(script)
55
57
  hfile = "#{hdir}/.#{script}_history"
56
58
  end
57
59
  end
58
60
 
59
- if !ENV['__REPL_WRAPPED'] && system("which rlwrap > /dev/null")
61
+ if !ENV['__REPL_WRAPPED'] && system("which rlwrap > /dev/null 2> /dev/null")
60
62
  ENV['__REPL_WRAPPED'] = '0'
61
63
 
62
64
  rlargs = ""
@@ -70,6 +72,10 @@ if ARGV[0] == '--debug'
70
72
  debug = ARGV.delete('--debug')
71
73
  end
72
74
 
75
+ if ARGV.include? '--stdin'
76
+ from_stdin = ARGV.delete('--stdin')
77
+ end
78
+
73
79
  command = ARGV.join(' ')
74
80
  show_help if command.empty?
75
81
 
@@ -89,7 +95,11 @@ loop do
89
95
  exit
90
96
  end
91
97
 
92
- run = "#{command} %s" % [ line, nil ]
98
+ if from_stdin
99
+ run = "echo \"%s\" | #{command}" % [ line, nil ]
100
+ else
101
+ run = "#{command} %s" % [ line, nil ]
102
+ end
93
103
  puts "$ #{run}" if debug
94
104
  system run
95
105
  warn "Use Ctrl-D (i.e. EOF) to exit" if line =~ /^(exit|quit)$/
data/man/repl.1 CHANGED
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ron/v0.3
2
2
  .\" http://github.com/rtomayko/ron/
3
3
  .
4
- .TH "REPL" "1" "December 2009" "DEFUNKT" ""
4
+ .TH "REPL" "1" "January 2010" "DEFUNKT" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBrepl\fR \-\- sometimes you need a repl
@@ -110,6 +110,10 @@ Did you mean this?
110
110
  Displays usage information.
111
111
  .
112
112
  .TP
113
+ \fB\-\-stdin\fR
114
+ Pipe input to command's STDIN.
115
+ .
116
+ .TP
113
117
  \fB\-\-debug\fR
114
118
  Displays debug information while running.
115
119
  .
@@ -148,6 +148,8 @@ Did you mean this?
148
148
  <code>-h</code>, <code>--help</code>
149
149
  </dt>
150
150
  <dd><p>Displays usage information.</p></dd>
151
+ <dt class="flush"><code>--stdin</code></dt>
152
+ <dd><p>Pipe input to command's STDIN.</p></dd>
151
153
  <dt class="flush"><code>--debug</code></dt>
152
154
  <dd><p>Displays debug information while running.</p></dd>
153
155
  <dt class="flush"><code>--man</code></dt>
@@ -211,7 +213,7 @@ redis-cli</code> prompt.</p>
211
213
 
212
214
  <ol class='foot man'>
213
215
  <li class='tl'>DEFUNKT</li>
214
- <li class='tc'>December 2009</li>
216
+ <li class='tc'>January 2010</li>
215
217
  <li class='tr'>repl(1)</li>
216
218
  </ol>
217
219
 
@@ -82,6 +82,9 @@ Using `repl` with `git`:
82
82
  * `-h`, `--help`:
83
83
  Displays usage information.
84
84
 
85
+ * `--stdin`:
86
+ Pipe input to command's STDIN.
87
+
85
88
  * `--debug`:
86
89
  Displays debug information while running.
87
90
 
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.2.0
4
+ version: 0.2.1
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-19 00:00:00 -08:00
12
+ date: 2010-01-04 00:00:00 -08:00
13
13
  default_executable: repl
14
14
  dependencies: []
15
15