mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-01-23 02:35:38 +01:00
feat(x-cmd): Improve silent execution and simplify setup prompt
This commit is contained in:
parent
697b9a9930
commit
de26c8cd22
1 changed files with 5 additions and 14 deletions
|
|
@ -11,9 +11,9 @@ x(){(
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local cmdstr=""
|
local cmdstr=""
|
||||||
if command -v curl 2>/dev/null; then
|
if command -v curl >/dev/null 2>&1; then
|
||||||
cmdstr='eval "$(curl -s https://get.x-cmd.com)"'
|
cmdstr='eval "$(curl -s https://get.x-cmd.com)"'
|
||||||
elif command -v wget 2>/dev/null; then
|
elif command -v wget >/dev/null 2>&1; then
|
||||||
cmdstr='eval "$(wget -O- https://get.x-cmd.com)"'
|
cmdstr='eval "$(wget -O- https://get.x-cmd.com)"'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
@ -21,24 +21,15 @@ x(){(
|
||||||
@info "Command using is -> $cmdstr"
|
@info "Command using is -> $cmdstr"
|
||||||
|
|
||||||
local answer=""
|
local answer=""
|
||||||
read -q "Please press y for yes, n for no. Ctrl-C will also abort the setup." answer || {
|
read -q "answer?Please press y for yes. Ctrl-C will also abort the setup. "
|
||||||
@info "Received intrrupt. Exit with error code 130."
|
|
||||||
return 130
|
|
||||||
}
|
|
||||||
|
|
||||||
case "$answer" in
|
case "$answer" in
|
||||||
n|N|no)
|
|
||||||
@info "Received $answer. Exit the setup immediately."
|
|
||||||
return 0
|
|
||||||
;;
|
|
||||||
y|Y|yes)
|
y|Y|yes)
|
||||||
@info "Received $answer. Setup is going now."
|
echo "Setup is going now."
|
||||||
eval "$cmdstr"
|
eval "$cmdstr"
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
@info "Received unknown $answer."
|
echo ""
|
||||||
return 1
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
)}
|
)}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue