Alias are used to create a alias to another or several others command (yeah, really !!!!)

They are created and use as Command excepting that, instead of doing some action, they return a string representing what user could have entered:

from devparrot.core.command import Alias

def helloworld7(arg):
    """just relaunch helloworld6 preceding the argument with "foo" """
    return "helloworld6 {0!r}".format("foo"+arg)

Keep in mind that the returning string will be parsed again as if the user enter it. It must correspond to a valid command entry. You have to be carreful with user input. For example in helloworld7, user could have enter a string with space. It's to you to escape the space in the argument, or enclose the argument with quote. The best way to do so is to use the representation of the string instead of the string itself. (This is why the {0!r} instead of just {0})

Alias can also use constraints as Command do. It is still to you to convert the arguments you will get in the correct string format.

Alias can be use to pipe several command together:

def helloworld8():
    return "helloworld6 'foo' | helloworld6 'bar'"

Alias can also be use to launch several command one after other:

def helloworld9():
    return "helloworld6 "foo" \n helloworld6 bar"

Alias are really useful to combine command section and provide highlevel command to user:

def command(arg):
    return "private.command {0!r} | hellostrean foo".format(arg)