mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2025-11-04 21:31:19 +08:00
parent
c2a69fe590
commit
cef64c465a
@ -28,6 +28,7 @@
|
||||
# CHSH - 'no' means the installer will not change the default shell (default: yes)
|
||||
# RUNZSH - 'no' means the installer will not run zsh after the install (default: yes)
|
||||
# KEEP_ZSHRC - 'yes' means the installer will not replace an existing .zshrc (default: no)
|
||||
# OVERWRITE_CONFIRMATION - 'no' means the installer will not ask for confirmation to overwrite the existing .zshrc (default: yes)
|
||||
#
|
||||
# You can also pass some arguments to the install script to set some these options:
|
||||
# --skip-chsh: has the same behavior as setting CHSH to 'no'
|
||||
@ -77,6 +78,7 @@ BRANCH=${BRANCH:-master}
|
||||
CHSH=${CHSH:-yes}
|
||||
RUNZSH=${RUNZSH:-yes}
|
||||
KEEP_ZSHRC=${KEEP_ZSHRC:-no}
|
||||
OVERWRITE_CONFIRMATION=${OVERWRITE_CONFIRMATION:-yes}
|
||||
|
||||
|
||||
command_exists() {
|
||||
@ -342,6 +344,7 @@ setup_zshrc() {
|
||||
return
|
||||
fi
|
||||
|
||||
if [ $OVERWRITE_CONFIRMATION != "no" ]; then
|
||||
# Ask user for confirmation before backing up and overwriting
|
||||
echo "${FMT_YELLOW}Found ${zdot}/.zshrc."
|
||||
echo "The existing .zshrc will be backed up to .zshrc.pre-oh-my-zsh if overwritten."
|
||||
@ -357,6 +360,7 @@ setup_zshrc() {
|
||||
[Nn]*) echo "Overwrite skipped. Existing .zshrc will be kept."; return ;;
|
||||
*) echo "Invalid choice. Overwrite skipped. Existing .zshrc will be kept."; return ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
if [ -e "$OLD_ZSHRC" ]; then
|
||||
OLD_OLD_ZSHRC="${OLD_ZSHRC}-$(date +%Y-%m-%d_%H-%M-%S)"
|
||||
@ -510,12 +514,13 @@ main() {
|
||||
if [ ! -t 0 ]; then
|
||||
RUNZSH=no
|
||||
CHSH=no
|
||||
OVERWRITE_CONFIRMATION=no
|
||||
fi
|
||||
|
||||
# Parse arguments
|
||||
while [ $# -gt 0 ]; do
|
||||
case $1 in
|
||||
--unattended) RUNZSH=no; CHSH=no ;;
|
||||
--unattended) RUNZSH=no; CHSH=no; OVERWRITE_CONFIRMATION=no ;;
|
||||
--skip-chsh) CHSH=no ;;
|
||||
--keep-zshrc) KEEP_ZSHRC=yes ;;
|
||||
esac
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user