centoria-0.1.1 is not a library.
Centoria
Centoria - function manager for macOS and Linux.
Usage
initialize or reload centoria:
# bash or zsh
# fish
| )
Add a function that work as alias:
Remove a function:
You can use conditional statement:
# if `which rg` returns success code (exit 0), you can use `search` command.
If you want to pass the arguments anywhere, you can specify them using {INDEXER}
as placeholder.
Example:
- You want the 1st arguments, please use
{0}
for placeholder. - You want the 1st, 2nd and 3rd arguments, please use
{0..3}
for placeholder. - You want the 2nd and later arguments, please use
{2..}
for placeholder. - You want the 2nd and later arguments, but they are optional, please use
{2..?}
for placeholder.?
acts as optional parameter- Single Optional :
{0?}
- Multiple Optional :
{0..?}
- Single Optional :
# explicitly set the position of a parameter for search
# "show-err-logs nginx" expands as "tail -f /var/log/nginx/error.log"
Centoria also supports functions as sub-command:
# `docker c` expands as `docker container`
# also use function (this function has no meaning, but an example)
# remove
Execute the function:
# direct (required `cet init`)
# via centoria
# subcommands (direct, required `cet init`)
# subcommands (via centoria)
If you want to use centoria as collection of subcommands:
# 1st, create a base command
# 2nd, write functions to /path/to/config.toml
# 3rd, execute via base command
For more information about Centoria, please see the result of cet help
or cet help <COMMAND>
.
Centoria TOML configuration
Centoria find configuration from the following paths:
$CENTORIA_CONFIG_PATH
- System configuration directory
- Linux:
$XDG_CONFIG_HOME/centoria/centoria.toml
or$HOME/.config/centoria/centoria.toml
- macOS:
$HOME/Library/Preferences/centoria/centoria.toml
- Windows:
$APPDATA/centoria/centoria.toml
- Linux:
$HOME/.centoria.toml
If you add a new function from command-line, Centoria creates a new file in $HOME/.centoria.toml
.
example centoria.toml
:
[]
= 'alias'
= 'rg'
= 'which rg'
[]
= 'function'
= 'tail -f /var/log/{0}/error.log'
= 'show error logs'
= [
'application name' # description of argument {0}
]
[]
= 'subcommand'
= 'docker'
[]
= 'container'