diff --git a/LICENSE "b/LICENS\320\225" similarity index 100% rename from LICENSE rename to "LICENS\320\225" diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..6416156 --- /dev/null +++ b/Makefile @@ -0,0 +1,9 @@ +MAN=$$(head -1 /etc/manpaths) + +install: + cp bin/repl /usr/bin/repl + cp man/repl.1 $(MAN)/man1/ + +uninstall: + rm /usr/bin/repl + rm $(MAN)/man1/repl.1 diff --git a/README.md b/README.md index 2262af1..86f6184 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ -repl(1) -- sometimes you need a repl -==================================== +REPL +==== `repl` is an interactive program which tenderly wraps another, non-interactive program. @@ -7,28 +7,26 @@ non-interactive program. For example: $ repl redis-cli -p 6665 - >> set name chris + redis-cli>> set name chris OK - >> get name + redis-cli>> get name chris - >> info + redis-cli>> info redis_version:1.000 uptime_in_seconds:182991 uptime_in_days:2 - .. etc .. - Or: $ repl gem - >> --version + gem>> --version 1.3.5 - >> search yajl + gem>> search yajl *** LOCAL GEMS *** yajl-ruby (0.6.7) - >> search yajl -r + gem>> search yajl -r *** REMOTE GEMS *** @@ -38,22 +36,21 @@ Or: oortle-yajl-ruby (0.5.8) yajl-ruby (0.6.7) - Or even: $ repl git - >> branch + git>> branch gh-pages * master - >> tag + git>> tag rm v0.1.0 v0.1.1 v0.1.2 v0.1.3 - >> tag -d rm + git>> tag -d rm Deleted tag 'rm' - >> pwd + git>> pwd git: 'pwd' is not a git-command. See 'git --help'. Did you mean this? @@ -62,7 +59,7 @@ Or even: You can also use `%s` to tell repl where to stick the input: $ repl heroku %s --app domainy - >> info + heroku>> info === domainy Web URL: http://domainy.heroku.com/ Git Repo: git@heroku.com:domainy.git @@ -74,8 +71,7 @@ You can also use `%s` to tell repl where to stick the input: Addons: Piggyback SSL Owner: b****@*******.com - -If you have [rlwrap(1)][0] installed you'll automatically get the full +If you have [rlwrap][0] installed you'll automatically get the full benefits of readline: history, reverse searches, etc. `repl` is meant to wrap programs which accept command line arguments @@ -83,27 +79,37 @@ and print to the standard output. It keeps no state between executed lines and, as such, cannot be used to replace `irb` or the Python REPL (for example). - Install ------- -### Standalone +### Rubygems + +`repl` can be installed as a gem: -`repl` is easily installed as a standalone script: +```sh +gem install repl +``` - export REPL_BIN=~/bin/repl - curl -s https://raw.github.com/defunkt/repl/latest/bin/repl > $REPL_BIN - chmod 755 $REPL_BIN +### Make -Change `$REPL_BIN` to your desired location and have at! (Just make -sure it's in your `$PATH`.) +Download this repo, and then just `make` your installation: -### RubyGems +```sh +cd repl-master +sudo make +``` -`repl` can also be installed as a RubyGem: +To uninstall, use `sudo make uninstall`. - $ gem install repl +### Curl +You can install REPL without downloading the whole repo. This way: + +```sh +curl -s https://raw.github.com/defunkt/repl/master/bin/repl > /usr/bin/repl +curl -s https://raw.github.com/defunkt/repl/master/man/repl.1 > /usr/local/share/man/man1/repl.1 +chmod +x /usr/bin/repl +``` Completion ---------- @@ -129,11 +135,13 @@ Configuration The following environment variables affect `repl`'s behavior: `REPL_PROMPT`: - the prompt to display before each line of input. defaults to >> + the prompt to display before each line of input. defaults to %s>> `REPL_COMPLETION_DIR`: directory in which completion files are kept +`REPL_HISTORY_DIR`: + directory in which command history files are kept Contributing ------------ @@ -146,22 +154,19 @@ Once you've made your great commits: 4. Create an [Issue][2] with a link to your branch 5. That's it! - Meta ---- * Code: `git clone git://github.com/defunkt/repl.git` * Home: * Bugs: -* Gems: - +* Gems: Author ------ Chris Wanstrath :: chris@ozmm.org :: @defunkt - [0]: http://utopia.knoware.nl/~hlub/rlwrap/ [1]: http://help.github.com/forking/ [2]: https://github.com/defunkt/repl/issues diff --git a/Rakefile b/Rakefile index 62b26d2..72a57e5 100644 --- a/Rakefile +++ b/Rakefile @@ -1,43 +1,39 @@ -$LOAD_PATH.unshift 'lib' -require "repl/version" - -def version - Repl::VERSION -end +Dir.chdir File.dirname(__FILE__) +version = `bin/repl -v`[/\d+\.\d+\.\d+/] def git(command) - system("git #{command}") + sh "git #{command}" end -desc "Build manual" +desc 'Build manual' task :build_man do - sh "ronn -br5 --organization=DEFUNKT man/*.ronn" + sh 'ronn -br5 --organization=DEFUNKT man/*.ronn' end -desc "Build and show manual" +desc 'Build and show manual' task :man => :build_man do - exec "man man/repl.1" + exec 'man man/repl.1' end -desc "Push a new version to Gemcutter" +desc 'Push a new version to Rubygems' task :publish do git "tag v#{version}" git "push origin v#{version}" - git "push origin master" - git "push origin master:latest" - sh "gem build repl.gemspec" + git 'push origin master' + git 'push origin master:latest' + sh 'gem build repl.gemspec' sh "gem push repl-#{version}.gem" - git "clean -fd" - exec "rake pages" + git 'clean -fd' + exec 'rake pages' end -desc "Publish to GitHub Pages" -task :pages => [ :build_man ] do - cp "man/repl.1.html", "html" - git "checkout gh-pages" - mv "html", "index.html" +desc 'Publish to GitHub Pages' +task :pages => :build_man do + cp 'man/repl.1.html', 'html' + git 'checkout gh-pages' + mv 'html', 'index.html' git "commit -a -m 'update docs'" - git "push origin gh-pages" - git "checkout master" + git 'push origin gh-pages' + git 'checkout master' puts :done end diff --git a/bin/repl b/bin/repl old mode 100644 new mode 100755 index bd6a605..8eb7f55 --- a/bin/repl +++ b/bin/repl @@ -1,106 +1,51 @@ #!/usr/bin/env ruby +require 'optparse' -# repl(1) -- sometimes you need a repl -# -# repl is an interactive program which tenderly wraps another, -# non-interactive program. -# -# For example: -# -# $ repl redis-cli -# >> set name chris -# OK -# >> get name -# chris -# -# If you have rlwrap(1) installed you'll get the full benefits of -# readline: history, reverse searches, etc. +executable = ARGV.find_index { |a| not a[/^-/] } +man = File.dirname(__FILE__) + '/../man/repl.1' -def show_help - puts <<-help -Usage: repl [options] command ... +options = executable ? ARGV.shift(executable) : ARGV +program = ARGV.join(' ') +settings = {} -Options: - --help Display this message - --stdin Pipe input to command's STDIN - --debug Display each command executed - --man Display the man page +# If nothing but options specified, or nothing +# specified at all, show some help information: +options << %w[-h] unless executable -Bug reports, suggestions, updates: -http://http://github.com/defunkt/repl/issues -help - exit -end - -if ARGV.empty? || ARGV.any? { |arg| %w( -h --help -help help ).include?(arg) } - show_help -end +OptionParser.new do |o| + o.banner += ' command' + o.summary_width = 17 + o.on('-h', '--help', 'Display this message') { puts o; exit } + o.on('-s', '--stdin', "Pipe input to command's STDIN") { settings[:stdin] = true } + o.on('-d', '--debug', 'Display each command executed') { settings[:debug] = true } + o.on('-m', '--man', 'Display the man page') { exec File.exists?(man) ? "man #{man}" : 'man repl' } + o.on('-v', '--version', 'Print REPL version') { puts 'REPL 1.0.0'; exit } +end.parse(options) -if ARGV.include? '--man' - dir = File.dirname(__FILE__) - exec "man #{dir}/../man/repl.1" -end +name = program.sub('%s', '').gsub(/\W/, '') -completion_dir = ENV['REPL_COMPLETION_DIR'] || "~/.repl" -if File.exists?(cdir = File.expand_path(completion_dir)) - script = ARGV.detect { |a| a !~ /^-/ } - if script - cfile = Dir[cdir + '/' + File.basename(script)].first - cfile = nil if cfile && !File.exists?(cfile) - end -end +completion_dir = File.expand_path(ENV['REPL_COMPLETION_DIR'] || '~/.repl') +history_dir = File.expand_path(ENV['REPL_HISTORY_DIR'] || '~') -history_dir = ENV['REPL_HISTORY_DIR'] || "~/" -if File.exists?(hdir = File.expand_path(history_dir)) - if script = ARGV.detect { |a| a !~ /^-/ } - script = File.basename(script) - hfile = "#{hdir}/.#{script}_history" - end -end +settings[:completion] = "-f #{completion_dir}/#{name}" if File.exists? completion_dir +settings[:history] = "-H #{history_dir}/.#{name}_history" if File.exists? history_dir -if !ENV['__REPL_WRAPPED'] && system("which rlwrap > /dev/null 2> /dev/null") +if `which rlwrap 1>&2> /dev/null` && !ENV['__REPL_WRAPPED'] ENV['__REPL_WRAPPED'] = '0' - - rlargs = "" - rlargs << " -f #{cfile}" if cfile - rlargs << " -H #{hfile}" if hfile - - exec "rlwrap #{rlargs} #$0 #{ARGV.join(' ')}" + rlwrap = ['rlwrap', settings[:completion], settings[:history], $0, options.join(' '), program] * ' ' + puts rlwrap if settings[:debug] + exec rlwrap end -if ARGV[0] == '--debug' - debug = ARGV.delete('--debug') -end - -if ARGV.include? '--stdin' - from_stdin = ARGV.delete('--stdin') -end +puts settings.to_a.map { |n| n * ': ' } * "\n" << "\nprogram: #{program}" if settings[:debug] -command = ARGV.join(' ') -show_help if command.empty? - -if debug - print 'rlwrap ' if ENV['__REPL_WRAPPED'] - print "-f #{cfile} " if cfile - print "-H #{hfile} " if hfile - puts command.inspect -end +prompt = (ENV['REPL_PROMPT'] || '%s>> ') % ARGV.first +pattern = settings[:stdin] ? "echo \"%s\" | #{program}" : "#{program} %s" +%w[INT TERM].each { |s| trap(s) { abort '' } } loop do - print ENV['REPL_PROMPT'] || "#{ARGV[0]}>> " - - begin - line = $stdin.gets.chomp - rescue NoMethodError, Interrupt - exit - end - - if from_stdin - run = "echo \"%s\" | #{command}" % [ line, nil ] - else - run = "#{command} %s" % [ line, nil ] - end - puts "$ #{run}" if debug - system run - warn "Use Ctrl-D (i.e. EOF) to exit" if line =~ /^(exit|quit)$/ + print prompt + command = pattern % [STDIN.gets.chomp, nil] + puts "$ #{command}" if settings[:debug] + system command end diff --git a/lib/repl/version.rb b/lib/repl/version.rb deleted file mode 100644 index 8e34404..0000000 --- a/lib/repl/version.rb +++ /dev/null @@ -1,3 +0,0 @@ -module Repl - VERSION = "1.0.0" -end diff --git a/man/repl.1 b/man/repl.1 index c42ff86..7c44756 100644 --- a/man/repl.1 +++ b/man/repl.1 @@ -1,29 +1,22 @@ -.\" generated with Ronn/v0.5 -.\" http://github.com/rtomayko/ronn/ +.\" generated with Ronn/v0.7.3 +.\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "REPL" "1" "May 2010" "DEFUNKT" "" +.TH "REPL" "1" "July 2013" "DEFUNKT" "" . .SH "NAME" -\fBrepl\fR \-\- sometimes you need a repl +\fBrepl\fR \- read\-eval\-print\-loop wrapper . .SH "SYNOPSIS" -\fBrepl\fR \fI[repl\-options]\fR \fIcommand\fR <...> +\fBrepl\fR [\fIoptions\fR] \fIcommand\fR . .SH "DESCRIPTION" -\fBrepl\fR wraps a non\-interactive \fBcommand\fR in an interactive -read\-eval\-print\-loop prompt. Each line you type into the prompt is -executed as arguments to \fBcommand\fR. Anything written to standard -output or standard error by the \fBcommand\fR is displayed. +\fBrepl\fR wraps a non\-interactive \fBcommand\fR in an interactive read\-eval\-print\-loop prompt\. Each line you type into the prompt is executed as arguments to \fBcommand\fR\. Anything written to standard output or standard error by the \fBcommand\fR is displayed\. . .P -If you have \fBrlwrap(1)\fR installed you'll automatically get the full -benefits of readline: history, reverse searches, etc. +If you have \fBrlwrap(1)\fR installed you\'ll automatically get the full benefits of readline: history, reverse searches, etc\. . .P -\fBrepl\fR is meant to wrap programs which accept command line arguments -and print to the standard output. It keeps no state between executed -lines and, as such, cannot be used to replace \fBirb\fR or the Python -REPL (for example). +\fBrepl\fR is meant to wrap programs which accept command line arguments and print to the standard output\. It keeps no state between executed lines and, as such, cannot be used to replace \fBirb\fR or the Python REPL (for example)\. . .SH "EXAMPLES" Using \fBrepl\fR with \fBredis\-cli\fR: @@ -33,44 +26,43 @@ Using \fBrepl\fR with \fBredis\-cli\fR: .nf $ repl redis\-cli ->> set name chris +redis\-cli>> set name chris OK ->> get name +redis\-cli>> get name chris ->> info -redis_version:1.000 +redis\-cli>> info +redis_version:1\.000 uptime_in_seconds:182991 uptime_in_days:2 -.. etc .. . .fi . .IP "" 0 . .P -Using \fBrepl\fR with Ruby's \fBgem\fR: +Using \fBrepl\fR with Ruby\'s \fBgem\fR: . .IP "" 4 . .nf $ repl gem ->> \-\-version -1.3.5 ->> search yajl +gem>> \-\-version +1\.3\.5 +gem>> search yajl *** LOCAL GEMS *** -yajl\-ruby (0.6.7) ->> search yajl \-r +yajl\-ruby (0\.6\.7) +gem>> search yajl \-r *** REMOTE GEMS *** -brianmario\-yajl\-ruby (0.6.3) -filipegiusti\-yajl\-ruby (0.6.4) -jdg\-yajl\-ruby (0.5.12) -oortle\-yajl\-ruby (0.5.8) -yajl\-ruby (0.6.7) +brianmario\-yajl\-ruby (0\.6\.3) +filipegiusti\-yajl\-ruby (0\.6\.4) +jdg\-yajl\-ruby (0\.5\.12) +oortle\-yajl\-ruby (0\.5\.8) +yajl\-ruby (0\.6\.7) . .fi . @@ -84,19 +76,19 @@ Using \fBrepl\fR with \fBgit\fR: .nf $ repl git ->> branch +git>> branch gh\-pages * master ->> tag +git>> tag rm -v0.1.0 -v0.1.1 -v0.1.2 -v0.1.3 ->> tag \-d rm -Deleted tag 'rm' ->> pwd -git: 'pwd' is not a git\-command. See 'git \-\-help'. +v0\.1\.0 +v0\.1\.1 +v0\.1\.2 +v0\.1\.3 +git>> tag \-d rm +Deleted tag \'rm\' +git>> pwd +git: \'pwd\' is not a git\-command\. See \'git \-\-help\'\. Did you mean this? add @@ -109,50 +101,46 @@ Did you mean this? . .TP \fB\-h\fR, \fB\-\-help\fR -Displays usage information. +Displays usage information\. . .TP -\fB\-\-stdin\fR -Pipe input to command's STDIN. +\fB\-s\fR, \fB\-\-stdin\fR +Pipe input to command\'s STDIN\. . .TP -\fB\-\-debug\fR -Displays debug information while running. +\fB\-d\fR, \fB\-\-debug\fR +Displays debug information while running\. . .TP -\fB\-\-man\fR -Displays this man page. +\fB\-m\fR, \fB\-\-man\fR +Displays this man page\. +. +.TP +\fB\-v\fR, \fB\-\-version\fR +Prints REPL version\. . .SH "COMPLETION" -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 -be used for completion. +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 be used for completion\. . .P -For instance, a file named \fB~/.repl/redis\-cli\fR containing "get set -info" will cause "get", "set", and "info" to be tab completeable at -the \fBrepl redis\-cli\fR prompt. +For instance, a file named \fB~/\.repl/redis\-cli\fR containing "get set info" will cause "get", "set", and "info" to be tab completeable at the \fBrepl redis\-cli\fR prompt\. . .P -The directory searched for completion files can be configured using -the \fBREPL_COMPLETION_DIR\fR environment variable. +The directory searched for completion files can be configured using the \fBREPL_COMPLETION_DIR\fR environment variable\. . .SH "COMMAND HISTORY" -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 -with a dot and suffixed with "_history" will be used for completion. +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 with a dot and suffixed with "_history" will be used for completion\. . .P -For instance, a file named \fB~/.redis\-cli_history\fR containing a newline -separated list of "get set info" will cause "get", "set", and "info" -to be reachable using the up arrow as command history at the \fBrepl -redis\-cli\fR prompt. +For instance, a file named \fB~/\.redis\-cli_history\fR containing a newline separated list of "get set info" will cause "get", "set", and "info" to be reachable using the up arrow as command history at the \fBrepl redis\-cli\fR prompt\. . .P -The directory searched for history files can be configured using the \fBREPL_HISTORY_DIR\fR environment variable. +The directory searched for history files can be configured using the \fBREPL_HISTORY_DIR\fR environment variable\. . .SH "ENVIRONMENT" . .SS "REPL_PROMPT" -the prompt to display before each line of input. defaults to >> +the prompt to display before each line of input\. defaults to %s>>\. %s is for the program name . .SS "REPL_COMPLETION_DIR" directory in which completion files are kept @@ -161,10 +149,10 @@ directory in which completion files are kept directory in which command history files are kept . .SH "BUGS" -\fIhttp://github.com/defunkt/repl/issues\fR +\fIhttp://github\.com/defunkt/repl/issues\fR . .SH "AUTHOR" -Chris Wanstrath :: chris@ozmm.org :: @defunkt +Chris Wanstrath :: chris@ozmm\.org :: @defunkt . .SH "SEE ALSO" -rlwrap(1), readline(3), \fIhttp://github.com\fR, \fIhttp://github.com/defunkt/repl\fR +rlwrap(1), readline(3), \fIhttp://github\.com\fR, \fIhttp://github\.com/defunkt/repl\fR diff --git a/man/repl.1.html b/man/repl.1.html index 42abc24..acc6478 100644 --- a/man/repl.1.html +++ b/man/repl.1.html @@ -2,74 +2,86 @@ - - repl(1) -- sometimes you need a repl - - -
- -

repl(1)

- -
    -
  1. repl(1)
  2. -
  3. -
  4. repl(1)
  5. -
- -

NAME

-

repl -- sometimes you need a repl

- -

SYNOPSIS

- -

repl [repl-options] command <...>

- -

DESCRIPTION

+ + +
+ + + +
    +
  1. repl(1)
  2. +
  3. +
  4. repl(1)
  5. +
+ +

NAME

+

+ repl - read-eval-print-loop wrapper +

+ +

SYNOPSIS

+ +

repl [options] command

+ +

DESCRIPTION

repl wraps a non-interactive command in an interactive read-eval-print-loop prompt. Each line you type into the prompt is @@ -84,33 +96,32 @@

DESCRIPTION

lines and, as such, cannot be used to replace irb or the Python REPL (for example).

-

EXAMPLES

+

EXAMPLES

Using repl with redis-cli:

$ repl redis-cli
->> set name chris
+redis-cli>> set name chris
 OK
->> get name
+redis-cli>> get name
 chris
->> info
+redis-cli>> info
 redis_version:1.000
 uptime_in_seconds:182991
 uptime_in_days:2
-.. etc ..
 

Using repl with Ruby's gem:

$ repl gem
->> --version
+gem>> --version
 1.3.5
->> search yajl
+gem>> search yajl
 
 *** LOCAL GEMS ***
 
 yajl-ruby (0.6.7)
->> search yajl -r
+gem>> search yajl -r
 
 *** REMOTE GEMS ***
 
@@ -124,35 +135,36 @@ 

EXAMPLES

Using repl with git:

$ repl git
->> branch
+git>> branch
   gh-pages
 * master
->> tag
+git>> tag
 rm
 v0.1.0
 v0.1.1
 v0.1.2
 v0.1.3
->> tag -d rm
+git>> tag -d rm
 Deleted tag 'rm'
->> pwd
+git>> pwd
 git: 'pwd' is not a git-command. See 'git --help'.
 
 Did you mean this?
   add
 
-

OPTIONS

+

OPTIONS

-h, --help

Displays usage information.

-
--stdin

Pipe input to command's STDIN.

-
--debug

Displays debug information while running.

-
--man

Displays this man page.

+
-s, --stdin

Pipe input to command's STDIN.

+
-d, --debug

Displays debug information while running.

+
-m, --man

Displays this man page.

+
-v, --version

Prints REPL version.

-

COMPLETION

+

COMPLETION

Because rlwrap supports completion, repl does too. Any file in ~/.repl matching the name of the command you start repl with will @@ -165,7 +177,7 @@

COMPLETION

The directory searched for completion files can be configured using the REPL_COMPLETION_DIR environment variable.

-

COMMAND HISTORY

+

COMMAND HISTORY

Because rlwrap supports command history, repl does too. Any file in ~/ matching the name of the command you start repl with prefix @@ -179,40 +191,41 @@

COMMAND HISTORY

The directory searched for history files can be configured using the REPL_HISTORY_DIR environment variable.

-

ENVIRONMENT

+

ENVIRONMENT

-

REPL_PROMPT

+

REPL_PROMPT

-

the prompt to display before each line of input. defaults to >>

+

the prompt to display before each line of input. defaults to %s>>. +%s is for the program name

-

REPL_COMPLETION_DIR

+

REPL_COMPLETION_DIR

directory in which completion files are kept

-

REPL_HISTORY_DIR

+

REPL_HISTORY_DIR

directory in which command history files are kept

-

BUGS

+

BUGS

-

http://github.com/defunkt/repl/issues

+

http://github.com/defunkt/repl/issues

-

AUTHOR

+

AUTHOR

Chris Wanstrath :: chris@ozmm.org :: @defunkt

-

SEE ALSO

+

SEE ALSO

-

rlwrap(1), readline(3), http://github.com, -http://github.com/defunkt/repl

+

rlwrap(1), readline(3), http://github.com, +http://github.com/defunkt/repl

-
    -
  1. DEFUNKT
  2. -
  3. May 2010
  4. -
  5. repl(1)
  6. -
+
    +
  1. DEFUNKT
  2. +
  3. July 2013
  4. +
  5. repl(1)
  6. +
-
+
diff --git a/man/repl.1.ronn b/man/repl.1.ronn index d92cae2..5572822 100644 --- a/man/repl.1.ronn +++ b/man/repl.1.ronn @@ -1,9 +1,9 @@ -repl(1) - sometimes you need a repl -=================================== +repl(1) - read-eval-print-loop wrapper +====================================== ## SYNOPSIS -`repl` <[repl-options]> <...> +`repl` [] ## DESCRIPTION @@ -25,28 +25,27 @@ REPL (for example). Using `repl` with `redis-cli`: $ repl redis-cli - >> set name chris + redis-cli>> set name chris OK - >> get name + redis-cli>> get name chris - >> info + redis-cli>> info redis_version:1.000 uptime_in_seconds:182991 uptime_in_days:2 - .. etc .. Using `repl` with Ruby's `gem`: $ repl gem - >> --version + gem>> --version 1.3.5 - >> search yajl + gem>> search yajl *** LOCAL GEMS *** yajl-ruby (0.6.7) - >> search yajl -r + gem>> search yajl -r *** REMOTE GEMS *** @@ -60,18 +59,18 @@ Using `repl` with Ruby's `gem`: Using `repl` with `git`: $ repl git - >> branch + git>> branch gh-pages * master - >> tag + git>> tag rm v0.1.0 v0.1.1 v0.1.2 v0.1.3 - >> tag -d rm + git>> tag -d rm Deleted tag 'rm' - >> pwd + git>> pwd git: 'pwd' is not a git-command. See 'git --help'. Did you mean this? @@ -82,15 +81,18 @@ Using `repl` with `git`: * `-h`, `--help`: Displays usage information. - * `--stdin`: + * `-s`, `--stdin`: Pipe input to command's STDIN. - * `--debug`: + * `-d`, `--debug`: Displays debug information while running. - * `--man`: + * `-m`, `--man`: Displays this man page. + * `-v`, `--version`: + Prints REPL version. + ## COMPLETION Because `rlwrap` supports completion, `repl` does too. Any file in @@ -122,7 +124,8 @@ The directory searched for history files can be configured using the ### REPL_PROMPT -the prompt to display before each line of input. defaults to >> +the prompt to display before each line of input. defaults to %s>>. +%s is for the program name ### REPL_COMPLETION_DIR diff --git a/repl.gemspec b/repl.gemspec index e892476..d68e2fa 100644 --- a/repl.gemspec +++ b/repl.gemspec @@ -1,23 +1,16 @@ -$LOAD_PATH.unshift 'lib' -require "repl/version" +Dir.chdir File.dirname(__FILE__) Gem::Specification.new do |s| - s.name = "repl" - s.version = Repl::VERSION - s.date = Time.now.strftime('%Y-%m-%d') - s.summary = "sometimes you need a repl" - s.homepage = "http://github.com/defunkt/repl" - s.email = "chris@ozmm.org" - s.authors = [ "Chris Wanstrath" ] - s.has_rdoc = false + s.name = 'repl' + s.version = `bin/repl -v`[/\d+\.\d+\.\d+/] - s.files = %w( README.md Rakefile LICENSE ) - s.files += Dir.glob("bin/**/*") - s.files += Dir.glob("man/**/*") + s.has_rdoc = false + s.files = `git ls-files`.split("\n") + s.executables = %w[repl] - s.executables = %w( repl ) - s.description = <