IPython Documentation

Table Of Contents

Previous topic

Module: consoleapp

Next topic

Module: core.application

This Page

Module: core.alias

System command aliases.

Authors:

  • Fernando Perez
  • Brian Granger

3 Classes

class IPython.core.alias.AliasError

Bases: exceptions.Exception

class IPython.core.alias.InvalidAliasError

Bases: IPython.core.alias.AliasError

class IPython.core.alias.AliasManager(shell=None, **kwargs)

Bases: IPython.config.configurable.Configurable

__init__(shell=None, **kwargs)
call_alias(alias, rest='')

Call an alias given its name and the rest of the line.

define_alias(name, cmd)

Define a new alias after validating it.

This will raise an AliasError if there are validation problems.

expand_alias(line)

Expand an alias in the command line

Returns the provided command line, possibly with the first word (command) translated according to alias expansion rules.

[ipython]|16> _ip.expand_aliases(“np myfile.txt”)
<16> ‘q:/opt/np/notepad++.exe myfile.txt’
expand_aliases(fn, rest)

Expand multiple levels of aliases:

if:

alias foo bar /tmp alias baz foo

then:

baz huhhahhei -> bar /tmp huhhahhei

soft_define_alias(name, cmd)

Define an alias, but don’t raise on an AliasError.

transform_alias(alias, rest='')

Transform alias to system command string.

validate_alias(name, cmd)

Validate an alias and return the its number of arguments.

1 Function

IPython.core.alias.default_aliases()

Return list of shell aliases to auto-define.