First command

Most of the actions you can made use the command system.

Actually, all the actions you've already made, except direct text editing, are made by launching commands. This was hidding behind shortcuts and menus, but it was commands.

There is several way to launch a command :

The command bar

The command bar need to have the focus to allow you enter command. Focus on the command bar can be set by clicking on it or using the shorcut <Ctrl-Return>

We will see later on about binding. For now, lets discover the command system.

The command syntax

The syntax of a command order is the following :

<commandName> [ <argument>* [<argumentName>=<argumentValue>]* ]

There is the name of the command, followed by a certain number of arguments. As most other languages, tokens are separated by space chars.


If the argument contains no space, you can write it, as you want, with quotes or not:

<commandName> argument
<commandName> 'argument'
<commandName> "argument"

If you want a argument with spaces, you must escape the space or enclose your string with single or double quote:

<commandName> string\ with\ space
<commandName> "string with space"
<commandName> 'string with space'

Named argument

As in python you can give named arguments and, as in python, named arguments must come last.

<commandName> foo named=bar
<commandName> foo named="bar"

The name of the argument must not be enclosed by quotes.

The help command

Lets entering our first command. Click on the command bar and enter:


And press the <Enter> key.

That is! You have launch the help command.

It opens a new buffer with all help entris listed.

Without argument, the help command open a new buffer with all the help entries listed. There is one entry listing all commands known by devparrot. If you <Ctrl-Click> on a command name, a new buffer open with the help for this command.

Lets entering our second command. Click on the command bar and enter:

help help

That is! You have launch the help command with the "help" argument.

As you may have wonder, <Ctrl-Click> on a help entry just launch the associated command, as if you had enter it in the command bar.

If a command is properly launch, the status bar at the bottom of the window will display the command text entered on green background.

If the user input can't be interpreted by Devparrot, a small explanation text will be displayed on the status bar on a red background.

If the command can be launch but fail to finish, a explanationt will be displayed on the status bar on a pastel red background.

Argument types

When creating command, devellopers can associate a type to arguments.

Those association allow devparrot to :

When using the help command, the type of the arguments awainted by the command ard displayed.

The most useful information are :


You may want to use special values as argument to command. But you cannot enter them litteraly. (Think about the value of a option)

Macros are a way to provide "calculated" values to command as arguemnt

The syntax is the following

%macro(arg1, arg2, namearg=foo, ...)

If a macro do not take arguement, it is possible to avoid the brackets:


Macros cannot be used alone, they have to be used as command arguments:

command %macro1 command_arg %macro2(macro_arg)

Some macros return a list of values. In this case, macro's result can be expended with a double %:

command %%macro

The '%%' can be seen as the '*' operator in Python.

A concret example

Supose that you want to open all the file provided in the command line of devparrot.

So we could use


To get all the arguments given is the command line (except the options handled by Devparrot)

So we should use the "%%" syntax to pass each element of the list as a argument to the command:

open %%open(ARGUMENTS)

Try it ! It will (try to) open all the arguments you gave on the Devparrot commandline.

Yet again. This is the command launch at startup by Devparrot. And this is why your files are opened at startup.

If you change it (and you can) ... new behavior !


This is also possible to combine several commands together.

Commands can generate or consume a stream of data. Those command can be combined using a pipe (as in shell scripts).

The syntax is the following:

command1 [args] | command2 [args]

As in bash, it means that output of command1 will be given to command2.

You can know if a command take or generate a stream by looking in its help section.

A concret example

The core.buffer command can be used to create a new buffer. This command take one argument (the name of the buffer) and consume a stream (that will be inserted in the buffer)

The shell command is used to launch a shell command. It take as argument the command to launch and any arguments to pass to the subprocess. It also generate a stream (the standard output). (It can also take a steam as standard input, but we will not use it now)

If you want to launch a shell command and get the output in a buffer, you should use :

shell ls | core.buffer ls_output