prompt-toolkit / ptpython

A better Python REPL
BSD 3-Clause "New" or "Revised" License
5.22k stars 280 forks source link

support aliasing #64

Open flying-sheep opened 9 years ago

flying-sheep commented 9 years ago

Hi, my brain is wired to type ipython instead of ptipython, so I’d love to be able to simply alias ipython=ptipython

sadly my second-most used ipython call, ipython notebook fails this way.

i’d love to be able to type both ipython and ipython notebook/nbconvert/... and have it do the sensible thing.

you can get a list of subcommands using:

from IPython.terminal.ipapp import TerminalIPythonApp

app = TerminalIPythonApp()

subcommands = list(app.subcommands.keys())
jonathanslenders commented 9 years ago

Hi @flying-sheep,

Honestly, right now I'm not sure we are going to implement this. (I hope that real integration can be finished: https://github.com/ipython/ipython/issues/8489 ) For now, what about just using a bash script?

real_ipython=$(which ipython)
ipython() {
    if [ -z $1 ]; then
        ptipython
    else
        $real_ipython $@
    fi; 
}
flying-sheep commented 9 years ago

I'm not sure we are going to implement this.

why not, if i may ask?

For now, what about just using a bash script?

jup, i’m using if [[ $# == 0 ]], but else basically what you posted