This project (could be) really cool, but is no longer actively maintained. I (the author) stopped using it because I didn't want to add a kajillion command-completion scripts and/or translate bash shell completion functions to python. And I can't live without completion for very long!
However, if you're interested, let me know: If you want something added, or you find a bug, leave an issue. If you have a patch, do a pull request: I'll get to it when I get to it, which could be a day or a few months. If you'd like to take up maintenance yourself, that'd be great: let me know. Or, if a lot of people care, I'll start working on it again.
repla to convert any command into a shell. Think of it as a
generic repl. Or an interactive xargs. Think less typing. Think
- Do you use an awesome command that has lot's of subcommands, but no
shell? (e.g. git, gpg)
replasaves the day!
- Do you frequently call a certain command again and again? (e.g. make)
replasaves you typing!
- Do you need to retype the same long, boring arguments to a command
again and again, but with other options that vary?
replawill slash away the repetition!
Miss your shell, and don't wanna go cold turkey? Precede your command
with a bang and it gets passed to
!rm -rf bonkers blue
repla was born of my annoyance with retyping
git cmd all of the
time. So the focus of it's development is to make
git (or any command)
less annoying. And it does.
Simple: When you enter a line,
repla prepends the name of the currently
wrapped command, and executes the resulting command line. Further, you
can specify a list of prefix or postfix args that get added to the
command every time.
bash$ git --work-tree=temp-tree log --stat topic_branch -- file1 file2 somedir bash$ git --work-tree=temp-tree diff --cached ntopic_branch -- file1 file2 somedir bash$ git --work-tree=temp-tree add --patch -- file1 file2 somedir
git: %set prefix='--work-tree=temp-tree' git: %set postfix='topic_branch -- file1 file2 somedir' git: log --stat git: diff --cached git: add --patch
git: is the prompt; you don't have to type that!
You can simply and easily extend
repla's vocabulary, by writing a
short Python class defining custom builtin methods and sticking it on
the Python path. It's as simple as writing:
from repla.command import CmdBase class AwesomeCommands(CmdBase): def cmdHello(self, args): self.show("Hello, world!") def cmdFoo(self, args): if len(args) == 0: self.show("Nyhh!") elif len(args) > 1: self.show("Bahh!") else: self.show("Foo bar.")
and then in
git: %import python.path.module git: %hello Hello, world!
See here for details.
repla now sports command-line options, which was long overdue. Briefly:
repla [--set=OPTION=VALUE[,OPTION=VALUE]... [COMMAND [ARGS]]
You can set any option's value using the
--set option. It takes a
comma-separated list of
OPTION=VALUE pairs, and is equivalent to
%set OPTION=VALUE ... on the command line. You can separate
the flag from the
OPTION=VALUE pairs either with an equals sign or a
As a shorthand for
--set wrapped=COMMAND, you can give the command to
wrap after all of
repla's own options. Additionally, you can
additional arguments after the
COMMAND, which will be treated as prefix
- wrap any command:
- automatically send prefix/postfix args to the wrapped command
- Execute sh commands:
- Built-in commands:
- Extensible! You can make your own built-ins with Python.
- Set options (and command/args) from the command-line
- completion functions. Preferably without duplicating half of bash's source. (Suggestions?)
- help builtin. What use are all those shiny builtins without documentation? (On the way)
- allow custom builtins to execute other builtins or arbitrary command lines. (easy)
repla is licensed under the terms of the GNU General Public License,
version 2. Please see LICENSE for details.