-
Notifications
You must be signed in to change notification settings - Fork 0
/
switch-p10k-clock.sh
executable file
·62 lines (44 loc) · 1.07 KB
/
switch-p10k-clock.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/bash
set -e
function usage() {
cat <<USAGE
Usage: $0 [-c|--with-clock] [-h|--help]
Options:
-c|--with-clock: This switch enables clock.
-h|--help: Show this message.
USAGE
exit 1
}
with_clock=false
if [[ $# -eq 0 ]]; then
with_clock=false
fi
while [[ "$1" != "" ]]; do
case $1 in
-c | --with-clock)
with_clock=true
;;
-h | --help)
usage
exit 1
;;
*)
usage
exit 1
;;
esac
shift
done
# Backup p10k.zsh
mv $HOME/.p10k.zsh $HOME/.p10k.zsh_backup
# Install p10k config with clock
if [[ $with_clock == "true" ]]; then
echo "[$(date +"%Y-%m-%d %H:%M:%S")] Copying .p10k.zsh with clock ..."
cp $HOME/.p10k-with-clock.zsh $HOME/.p10k.zsh
# Install p10k config without clock
else
echo "[$(date +"%Y-%m-%d %H:%M:%S")] Copying .p10k.zsh without clock ..."
cp $HOME/.p10k-without-clock.zsh $HOME/.p10k.zsh
fi
# source $HOME/.p10k.zsh
echo "[$(date +"%Y-%m-%d %H:%M:%S")] Switch completed. Run 'source ~/.p10k.zsh' to apply changes ..."