-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathswitch-p10k-clock.ps1
45 lines (35 loc) · 1.08 KB
/
switch-p10k-clock.ps1
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
Param(
[switch]
[Parameter(Mandatory=$false)]
$WithClock,
[switch]
[Parameter(Mandatory=$false)]
$Help
)
function Show-Usage {
Write-Output "
Usage: $(Split-Path $MyInvocation.ScriptName -Leaf) [-WithClock] [-Help]
Options:
-WithClock: This switch enables clock.
-Help: Show this message.
"
Exit 0
}
# Show usage
if ($Help -eq $true) {
Show-Usage
Exit 0
}
# Backup p10k.omp.json
Copy-Item $HOME/p10k.omp.json $HOME/p10k.omp.json_backup -Force
# Install p10k with clock
if ($WithClock -eq $true) {
Write-Output "[$(Get-Date -Format "yyyy-MM-dd HH:mm:ss")] Installing theme: Powerlevel10k with clock ..."
Copy-Item $HOME/p10k-with-clock.omp.json $HOME/p10k.omp.json -Force
}
# Install p10 without clock
else {
Write-Output "[$(Get-Date -Format "yyyy-MM-dd HH:mm:ss")] Installing theme: Powerlevel10k without clock ..."
Copy-Item $HOME/p10k-without-clock.omp.json $HOME/p10k.omp.json -Force
}
Write-Output "[$(Get-Date -Format "yyyy-MM-dd HH:mm:ss")] Switch completed. Run '. `$PROFILE' to apply changes ..."