What’s different about Murex’s interactive shell?
Aside from Murex being carefully designed with scripting in mind, the interactive shell itself is also built around productivity. To achieve this we wrote our own readline library. Below is an example of that library in use:
The above demo includes the following features of Murex’s bespoke readline library:
cd
)kill
where the process ID was substituted when selected)cd
and kill
- enabled by pressing [ctrl]
+[f]
)vi
in the example - enabled by pressing [esc]
followed by [v]
)[esc]
)Murex uses a custom readline
library to enable support for new features on in addition to the existing uses you’d normally expect from a shell. It is because of this Murex provides one of the best user experiences of any of the shells available today.
A full breakdown of supported hotkeys is available at terminal-keys.html.
Autocompletion happen when you press [tab]
and will differ slightly depending on what is defined in autocomplete
and whether you use the traditional POSIX pipe token, |
, or the arrow pipe, ->
.
The |
token will behave much like any other shell however ->
will offer suggestions with matching data types (as seen in runtime --methods
). This is a way of helping highlight commands that naturally follow after another in a pipeline. Which is particularly important in Murex as it introduces data types and dozens of new builtins specifically for working with data structures in an intelligent and readable yet succinct way.
You can add your own commands and functions to Murex as methods by defining them with method
. For example if we were to add jq
as a method:
method: define jq {
"Stdin": "json",
"Stdout": "@Any"
}
Like with most IDEs, Murex will auto close brackets et al.
Pipelines in the interactive terminal are syntax highlighted. This is similar to what one expects from an IDE.
Syntax highlighting can be disabled by running:
» config: set shell syntax-highlighting off
Murex supports inline spellchecking, where errors are underlined. For example
This might require some manual steps to enable, please see the spellcheck user guide for more details.
The hint text is a (typically) blue status line that appears directly below your prompt. The idea behind the hint text is to provide clues to you as type instructions into the prompt; but without adding distractions. It is there to be used if you want it while keeping out of the way when you don’t want it.
By default the hint text will appear blue. This is also customizable:
» config get shell hint-text-formatting
{BLUE}
The formatting config takes a string and supports ANSI constants.
It is also worth noting that if colour is disabled then the hint text will not be coloured even if hint-text-formatting includes colour codes:
» config: set shell color false
(please note that syntax highlighting is unaffected by the above config)
There is a lot of behavior hardcoded into Murex like displaying the full path to executables and the values of variables. However if there is no status to be displayed then Murex can fallback to a default hint text status. This default is a user defined function. At time of writing this document the author has the following function defined:
config: set shell hint-text-func {
trypipe <!null> {
git status --porcelain -b -> set gitstatus
$gitstatus -> head -n1 -> regexp 's/^## //' -> regexp 's/\.\.\./ => /'
}
catch {
out "Not a git repository."
}
}
…which produces a colorized status that looks something like the following:
develop => origin/develop
It is enabled by default but can be disabled if you prefer a more minimal prompt:
» config: set shell hint-text-enabled false
->
) Token: Pipes STDOUT from the left hand command to STDIN of the right hand command{
, }
) Tokens: Initiates or terminates a code block|
) Token: Pipes STDOUT from the left hand command to STDIN of the right hand commandautocomplete
: Set definitions for tab-completion in the command lineconfig
: Query or define Murex runtime settingsmethod
: Define a methods supported data-typesruntime
: Returns runtime information on the internal state of MurexThis site's content is rebuilt automatically from murex's source code after each merge to the master
branch. Downloadable murex binaries are also built with the website.
Last built on Fri May 19 22:45:48 UTC 2023 against commit 54b5f6754b5f67b250bbf7353e83c42ed187802584c3ae3.
Current version is 4.1.6140 which has been verified against 14045 tests cases.