-
Notifications
You must be signed in to change notification settings - Fork 0
Features
This will go into detail on specific features that don't fall under a specific category.
Inline environment variables are a powerful feature that enable you to append environment variables to your current prompt instantly.
The syntax is as follows: {variable-name}
Examples: cd {USERPROFILE} -- this will take you to /Users/Name on windows. Equivalent to cd ~
The environment variables used aren't platform specific, they are whatever your systems environment contains at that time.
Whatever is inside the braces will be converted into its corresponding value for that variable. If the variable does not exist there are different behaviors depending on mode. If execution.strictmode is defined in the settings, this will be an error. If not, the name will be automatically appended to the string. (strictmode will be enabled by default).
Most people are used to the syntax of $ENV_VARIABLE
. Console switches it up by using {ENV_VARIABLE}
. The standard way of doing this is fine, it's just that it always ticked me off that it isn't fully captured. I feel like {NAME}
is very clear in what is going to be some other data.
For example, this is specifically powerful when using alias commands. Let's say there's a plugin loaded and when you run its command path
this path stores something inside of the _
environment variable. (confused? see this). You can alias with this nice and simple syntax:
alias cdpath="path && cd {$}"
This makes life much easier.
The option name
execution.strictmode
This is a configuration setting that is always present, but can either be true
or false
. When this option is set to true
, different things within Console will act in a more strict way, displaying errors whenever its possible. When it's set to false
it's more lenient.
An example of this is when using inline environment variables. When you use an environment variable that does not exist, if strictmode
is enabled, you will see this:
user@root$ echo {00}
ERROR: environment variable `00` does not exist.
Therefore it cannot be inserted inline.
This is particularly useful for testing scripts. You want to catch errors when possible.
There are currently two special environment variables.
"_" // This environment variable holds the return value from the last ran command.
"$" // This holds the entire output, or selected output from the previously ran command.
The return value storage is not currently useful, but once conditional commands are added it will be nice to check if the previously ran command failed, and then you can handle that from there.
For the previous output storage, this is useful when a command actually returns real data. This is a form of communication between them. Take this example:
find_plugin SomePlugin // this command stores the plugins uuid inside of the "$" variable.
unload_plugin {$} // This would use that value to remove it.
You can do custom text formatting from the commandline. This is done with the following syntax.
{:<content>:<specifier>}
This looks similar to an inline environment variable, which it is! The difference here is the content surrounded in colons. This signals Console that you want to format some text.
The only specifier right now is the x
specifier, which will repeat the contents. See it as something like content
xN
An example of this:
cd {:../:x5}
// This format gets baked into the input as "../../../../../", it is repeated 5 times because you specifier after the `x`.
// Now the directory will be 5 directory's back.
You must specify a number to repeat by.
-
strip
- removes all whitespace from the input -
trim
- removes all trailing and leading whitespace from the input.
main repo here