flesh/CONFIGURING.md
2021-11-08 00:59:14 -08:00

1.9 KiB

Configuration

By default Relish will read from ~/.relishrc for configuration, but the default shell will also accept a filename from the RELISH_CFG_FILE environment variable.

The configuration file

The configuration file is a script containing arbitrary Relish code. On start, any shell (including the default shell) which leverages the configuration code in the config module will create a clean seperate context, including default configuration values, within which the standard library will be initialized and the configuration file will be run. Afterwards, configuration values found in the variable map will be used to configure the standard library function mappings that the fully functional user shell will leverage. Errors during configuration are non-terminal and will result in default values being returned

Important points to note

  • When the configuration file is run, it will be run with default configuration values.
  • The user/script interpreter will be run with a re-instantiation of the standard library, using the previously defined configuration variables
  • Variables and functions defined during configuration will carry over to the user/script interpreter, allowing the user to load any number of custom functions and variables.

Configuration Values

The following are important variables that will determine the runtime behavior of the default shell or standard library functions:

Variable Default Value Explanation
CFG_RELISH_POSIX 0 When on, enables POSIX style job control. more information.
CFG_RELISH_ENV 1 When on, variables defined will be synchronized with environment variables.
CFG_RELISH_PROMPT (echo "λ ") note: this is a function not a variable. This function will be called to output the prompt each time the REPL loops.

Specific Behaviors

  • CFG_RELISH_POSIX is only loaded once and will be ignored after initial configuration.