mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-01-25 01:47:25 +08:00
Compare commits
No commits in common. "1a880fdb9b88c0c98a23d7b2ed2ddb42caef6662" and "3e9e385d98da148a7ad8e8d99da35ce6b7aae9ca" have entirely different histories.
1a880fdb9b
...
3e9e385d98
@ -1,16 +1,14 @@
|
|||||||
(( $+commands[npm] )) && {
|
(( $+commands[npm] )) && {
|
||||||
rm -f "${ZSH_CACHE_DIR:-$ZSH/cache}/npm_completion"
|
__NPM_COMPLETION_FILE="${ZSH_CACHE_DIR:-$ZSH/cache}/npm_completion"
|
||||||
|
|
||||||
_npm_completion() {
|
if [[ ! -f $__NPM_COMPLETION_FILE ]]; then
|
||||||
local si=$IFS
|
npm completion >! $__NPM_COMPLETION_FILE 2>/dev/null
|
||||||
compadd -- $(COMP_CWORD=$((CURRENT-1)) \
|
[[ $? -ne 0 ]] && rm -f $__NPM_COMPLETION_FILE
|
||||||
COMP_LINE=$BUFFER \
|
fi
|
||||||
COMP_POINT=0 \
|
|
||||||
npm completion -- "${words[@]}" \
|
[[ -f $__NPM_COMPLETION_FILE ]] && source $__NPM_COMPLETION_FILE
|
||||||
2>/dev/null)
|
|
||||||
IFS=$si
|
unset __NPM_COMPLETION_FILE
|
||||||
}
|
|
||||||
compdef _npm_completion npm
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Install dependencies globally
|
# Install dependencies globally
|
||||||
|
|||||||
@ -20,14 +20,12 @@
|
|||||||
# BRANCH - branch to check out immediately after install (default: master)
|
# BRANCH - branch to check out immediately after install (default: master)
|
||||||
#
|
#
|
||||||
# Other options:
|
# Other options:
|
||||||
# CHSH - 'no' means the installer will not change the default shell (default: yes)
|
# 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)
|
# 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)
|
|
||||||
#
|
#
|
||||||
# You can also pass some arguments to the install script to set some these options:
|
# 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'
|
# --skip-chsh: has the same behavior as setting CHSH to 'no'
|
||||||
# --unattended: sets both CHSH and RUNZSH to 'no'
|
# --unattended: sets both CHSH and RUNZSH to 'no'
|
||||||
# --keep-zshrc: sets KEEP_ZSHRC to 'yes'
|
|
||||||
# For example:
|
# For example:
|
||||||
# sh install.sh --unattended
|
# sh install.sh --unattended
|
||||||
#
|
#
|
||||||
@ -42,7 +40,6 @@ BRANCH=${BRANCH:-master}
|
|||||||
# Other options
|
# Other options
|
||||||
CHSH=${CHSH:-yes}
|
CHSH=${CHSH:-yes}
|
||||||
RUNZSH=${RUNZSH:-yes}
|
RUNZSH=${RUNZSH:-yes}
|
||||||
KEEP_ZSHRC=${KEEP_ZSHRC:-no}
|
|
||||||
|
|
||||||
|
|
||||||
command_exists() {
|
command_exists() {
|
||||||
@ -114,11 +111,6 @@ setup_zshrc() {
|
|||||||
# Must use this exact name so uninstall.sh can find it
|
# Must use this exact name so uninstall.sh can find it
|
||||||
OLD_ZSHRC=~/.zshrc.pre-oh-my-zsh
|
OLD_ZSHRC=~/.zshrc.pre-oh-my-zsh
|
||||||
if [ -f ~/.zshrc ] || [ -h ~/.zshrc ]; then
|
if [ -f ~/.zshrc ] || [ -h ~/.zshrc ]; then
|
||||||
# Skip this if the user doesn't want to replace an existing .zshrc
|
|
||||||
if [ $KEEP_ZSHRC = yes ]; then
|
|
||||||
echo "${YELLOW}Found ~/.zshrc.${RESET} ${GREEN}Keeping...${RESET}"
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
if [ -e "$OLD_ZSHRC" ]; then
|
if [ -e "$OLD_ZSHRC" ]; then
|
||||||
OLD_OLD_ZSHRC="${OLD_ZSHRC}-$(date +%Y-%m-%d_%H-%M-%S)"
|
OLD_OLD_ZSHRC="${OLD_ZSHRC}-$(date +%Y-%m-%d_%H-%M-%S)"
|
||||||
if [ -e "$OLD_OLD_ZSHRC" ]; then
|
if [ -e "$OLD_OLD_ZSHRC" ]; then
|
||||||
@ -235,7 +227,6 @@ main() {
|
|||||||
case $1 in
|
case $1 in
|
||||||
--unattended) RUNZSH=no; CHSH=no ;;
|
--unattended) RUNZSH=no; CHSH=no ;;
|
||||||
--skip-chsh) CHSH=no ;;
|
--skip-chsh) CHSH=no ;;
|
||||||
--keep-zshrc) KEEP_ZSHRC=yes ;;
|
|
||||||
esac
|
esac
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user