Documentation
¶
Overview ¶
Package shellrc adds and removes the block in the user's .zshrc and .bashrc that defines the mdsh function, which passes the calling shell's aliases and functions to blocks, and loads mdsh's completion.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // Zsh is ~/.zshrc, or $ZDOTDIR/.zshrc. Its completion line waits for // compinit, as has run by the end of most .zshrc files; without it, // compdef is missing and the line does nothing. Zsh = RC{ Wrapper: `function mdsh { command mdsh --source <(alias -L; typeset -f) "$@"; }`, Completion: `(( $+functions[compdef] )) && source <(command mdsh completion zsh)`, // contains filtered or unexported fields } // Bash is ~/.bashrc. Its wrapper leaves out its own function and // the completion's: their bash-only syntax would stop a /bin/sh that // is dash from sourcing the rest. Its completion line only runs in an // interactive shell, where complete does something. Bash = RC{ Wrapper: `function mdsh { command mdsh --source <(unset -f mdsh _mdsh; alias -p; declare -f) "$@"; }`, Completion: `[[ $- == *i* ]] && source <(command mdsh completion bash)`, // contains filtered or unexported fields } )
Functions ¶
This section is empty.
Types ¶
type RC ¶
type RC struct {
// Wrapper defines the mdsh function. The function keyword keeps an
// alias named mdsh from breaking the definition.
Wrapper string
// Completion loads mdsh's completion for the shell.
Completion string
// contains filtered or unexported fields
}
RC is one shell's startup file and the lines that go in it.
func (RC) Installed ¶
Installed reports whether the file at path has the block. A missing file doesn't.