feat: edit subcommand, for editing the alarm file directly
This commit is contained in:
parent
7abbf0625a
commit
72cca4da11
2 changed files with 51 additions and 0 deletions
31
test/edit.bats
Normal file
31
test/edit.bats
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
#!/usr/bin/env bats
|
||||
|
||||
load test_helper
|
||||
|
||||
@test "edit creates alarms file if missing" {
|
||||
[[ ! -f "${NAG_DIR}/alarms" ]]
|
||||
EDITOR="true" run_nag edit
|
||||
[[ "$status" -eq 0 ]]
|
||||
[[ -f "${NAG_DIR}/alarms" ]]
|
||||
}
|
||||
|
||||
@test "edit opens the alarms file in EDITOR" {
|
||||
write_alarm "1 9999999999 test alarm"
|
||||
EDITOR="cat" run_nag edit
|
||||
[[ "$status" -eq 0 ]]
|
||||
[[ "$output" == *"test alarm"* ]]
|
||||
}
|
||||
|
||||
@test "-e flag invokes edit" {
|
||||
write_alarm "1 9999999999 test alarm"
|
||||
EDITOR="cat" run_nag -e
|
||||
[[ "$status" -eq 0 ]]
|
||||
[[ "$output" == *"test alarm"* ]]
|
||||
}
|
||||
|
||||
@test "--edit flag invokes edit" {
|
||||
write_alarm "1 9999999999 test alarm"
|
||||
EDITOR="cat" run_nag --edit
|
||||
[[ "$status" -eq 0 ]]
|
||||
[[ "$output" == *"test alarm"* ]]
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue