Repository navigation
Expand file tree
/
Copy pathmise.toml
More file actions
60 lines (52 loc) · 1.94 KB
/
Copy pathmise.toml
File metadata and controls
60 lines (52 loc) · 1.94 KB
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
[tasks.build]
shell = 'powershell -Command'
run = '''
cargo build --release
'''
[tasks.kill]
shell = "powershell -Command"
run = 'if (Get-Process winkeylock -ErrorAction SilentlyContinue) { sudo taskkill /IM winkeylock.exe /F }'
[tasks.kill2]
shell = "powershell -Command"
run = '''
$taskName = "KillWinkeylock"
# 1. Check if the task exists; if not, prompt UAC once to create it with highest privileges
schtasks /query /tn $taskName *>$null
if ($LASTEXITCODE -ne 0) {
Write-Host "Scheduled task '$taskName' not found. Creating it (one-time UAC prompt)..." -ForegroundColor Yellow
Start-Process schtasks.exe -ArgumentList "/Create /TN $taskName /TR `"taskkill.exe /F /IM winkeylock.exe`" /SC ONCE /ST 00:00 /RL HIGHEST /F" -Verb RunAs -Wait
}
# 2. If winkeylock is running, run the elevated task to kill it and wait until it has fully exited
if (Get-Process winkeylock -ErrorAction SilentlyContinue) {
schtasks /Run /TN $taskName | Out-Null
$sw = [System.Diagnostics.Stopwatch]::StartNew()
while ((Get-Process winkeylock -ErrorAction SilentlyContinue) -and ($sw.ElapsedMilliseconds -lt 5000)) {
Start-Sleep -Milliseconds 50
}
Write-Host "winkeylock terminated." -ForegroundColor Green
}
'''
[tasks.build-run]
depends = ["kill2", "build"]
run = 'target\release\winkeylock.exe'
[tasks.tag]
shell = "powershell -Command"
run = '''
$env:VERSION=cargo get package.version
git tag --delete v$env:VERSION
git tag -a v$env:VERSION -m v$env:VERSION
'''
[tasks.gh-release]
shell = "powershell -Command"
run = '''
$env:VERSION=cargo get package.version
git push origin v$env:VERSION
gh release create v$env:VERSION target/release/winkeylock.exe --generate-notes
'''
depends = ["tag", "kill2", "build"]
[tasks.remove-unused]
run = '''
cargo install cargo-shear && cargo shear && cargo install cargo-features-manager && cargo features prune
'''
# also cargo install cargo-machete && cargo machete
# or cargo install cargo-udeps --locked && cargo udeps