Skip to main content Skip to docs navigation
Check
View on GitHub

Shell Support

Integrations of dotfiles-cli with supported shells.

On this page

RC File Header

The dotfiles-cli allows reloading an existing shell session easily without the need to open a new terminal tab or manually source any file. It allows reloading an active shell session by running the dotfiles reload command.

Since it is not possible to tamper with parent shell process environment from a nested shell, the dotfiles-cli adds a header to the RC file that enables the session reload to take place without creating a nested shell.

Supported RC files:

  • .zshrc
  • .bashrc
  • .bash_profile

Header example:

############################################################################# 
#           THIS SECTION IS AUTO-GENERATED BY THE dotfiles CLI 
# 
#                         dotfiles RELOAD SESSION 
#                (https://github.com/ZachiNachshon/dotfiles-cli) 
# Limitation: 
# It is not possible to tamper with parent shell process from a nested shell. 
# 
# Solution: 
# The dotfiles reload command creates a new shell session which in turn 
# run the RC file (this file). 
# The following script will source a reload_session.sh script under 
# current shell session without creating a nested shell session. 
############################################################################# 
dotfiles_cli_install_path=$(command -v dotfiles) 
# Path resolution to support Homebrew installation 
if [[ ${dotfiles_cli_install_path} == /usr/local/bin/dotfiles ]]; then 
  homebrew_dotfiles_cli_install_path=$(dirname $(readlink ${dotfiles_cli_install_path})) 
  homebrew_dotfiles_cli_install_path=${homebrew_dotfiles_cli_install_path/bin/libexec} 
  homebrew_dotfiles_cli_install_path=${homebrew_dotfiles_cli_install_path/..\/Cellar//usr/local/Cellar} 
  DOTFILES_CLI_INSTALL_PATH=${homebrew_dotfiles_cli_install_path} 
fi 
 
DOTFILES_CLI_INSTALL_PATH=${DOTFILES_CLI_INSTALL_PATH:-${HOME}/.config/dotfiles-cli} 
DOTFILES_CLI_RELOAD_SESSION_SCRIPT_PATH=${DOTFILES_CLI_INSTALL_PATH}/reload_session.sh 
 
if [[ -e ${DOTFILES_CLI_RELOAD_SESSION_SCRIPT_PATH} ]]; then 
  export LOGGER_SILENT=True 
  source ${DOTFILES_CLI_RELOAD_SESSION_SCRIPT_PATH} 
else 
  echo -e 'Dotfiles CLI is not installed, cannot load plugins/reload session. path: $DOTFILES_CLI_INSTALL_PATH' 
fi
Do not change the header location on the RC file since other session related content (exports / aliases) might rely on the reloaded sources.