Documentation
¶
Overview ¶
Package env holds the configuration file of hail, config.yaml, and the directory that holds it, as package env does in usql.
An interactive hail reads config.yaml, unless it runs under the name bash or sh, or --norc is given (D19). The file holds settings and not code. A function goes in a bash script that the file names under source, and the shell runs that script after the settings. ox reads the file, as it reads the command line, and fills Config from its keys. D27 holds the keys.
An example:
prompt: '\u@\h:\w\$ '
env:
EDITOR: vim
set: [noclobber]
shopt: [globstar]
aliases:
ll: ls -l
history:
file: ~/.local/state/hail/history
size: 10000
control: [ignoreboth]
editor:
vi: false
color: true
style: dracula
styles:
keyword: 'bold #ff79c6'
bindings:
- '"\C-o": "> output"'
- 'set completion-ignore-case on'
source:
- functions.sh
Index ¶
Constants ¶
const FileName = "config.yaml"
FileName is the name of the configuration file.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
// Prompt is PS1, and Prompt2 is PS2.
Prompt string `ox:"the primary prompt\\, PS1,key:prompt"`
Prompt2 string `ox:"the secondary prompt\\, PS2,key:prompt2"`
// Env holds the variables to set and export.
Env map[string]string `ox:"the variables to export,key:env"`
// Set holds the options of set -o to turn on, and Shopt the options of
// shopt.
Set []string `ox:"the options of set -o to turn on,key:set"`
Shopt []string `ox:"the options of shopt to turn on,key:shopt"`
// Aliases holds the aliases, by name.
Aliases map[string]string `ox:"the aliases,key:aliases"`
// HistoryFile, HistorySize, HistoryFileSize, HistoryControl and
// HistoryIgnore set HISTFILE, HISTSIZE, HISTFILESIZE, HISTCONTROL and
// HISTIGNORE. A list is joined with ":".
HistoryFile string `ox:"the history file\\, HISTFILE,key:history.file"`
HistorySize string `ox:"the size of the history\\, HISTSIZE,key:history.size"`
HistoryFileSize string `ox:"the size of the history file\\, HISTFILESIZE,key:history.file_size"`
HistoryControl []string `ox:"HISTCONTROL,key:history.control"`
HistoryIgnore []string `ox:"HISTIGNORE,key:history.ignore"`
// Vi starts the editor in vi mode, as set -o vi does. Color colors the
// line as the user types it. Style names the style of transit that
// gives the colors: a style that hail bundles, by its name, or a style
// file, by its path. An empty Style is repl.DefaultStyle. Styles gives
// the style of a kind of word, over Style.
Vi bool `ox:"edit in vi mode,key:editor.vi"`
Color bool `ox:"color the line,key:editor.color,default:true"`
Style string `ox:"the style of the colors\\, a name or the path of a file,key:editor.style"`
Styles map[string]string `ox:"the styles of the colors,key:editor.styles"`
// Bindings holds the key bindings, as the lines of an inputrc file.
// They apply after the inputrc file of the user, in order, as though
// they were one more inputrc file (D14). A line that sets the keymap
// holds for the lines after it.
Bindings []string `ox:"the key bindings\\, as lines of an inputrc file,key:editor.bindings"`
// Source holds the bash scripts that the shell runs after the settings,
// in order. A relative path is relative to the directory of the file.
Source []string `ox:"the scripts to run,key:source"`
}
Config is what config.yaml holds. A field that the file does not set keeps its zero value, and the shell keeps what it has.