feat: add nuke-state
...duh
This commit is contained in:
parent
02ec07cef2
commit
b9b3f93f51
2 changed files with 26 additions and 10 deletions
24
README.md
24
README.md
|
@ -10,6 +10,7 @@ a simple shift register built on piperw(1)
|
||||||
init-state <name>
|
init-state <name>
|
||||||
load-state <name> <target>
|
load-state <name> <target>
|
||||||
save-state <name> <value>
|
save-state <name> <value>
|
||||||
|
nuke-state <name>
|
||||||
```
|
```
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
|
@ -17,15 +18,18 @@ save-state <name> <value>
|
||||||
|
|
||||||
init-state flip
|
init-state flip
|
||||||
save-state flip "up"
|
save-state flip "up"
|
||||||
forstdin -E line
|
foreground {
|
||||||
load-state flip current
|
forstdin -E line
|
||||||
println "! state: $current"
|
load-state flip current
|
||||||
ifelse { s6-test "$line" = "flip" } {
|
println "! state: $current"
|
||||||
println "! flipping state"
|
ifelse { s6-test "$line" = "flip" } {
|
||||||
ifelse { s6-test "$current" = "up" } {
|
println "! flipping state"
|
||||||
save-state flip "down"
|
ifelse { s6-test "$current" = "up" } {
|
||||||
|
save-state flip "down"
|
||||||
|
}
|
||||||
|
save-state flip "up"
|
||||||
}
|
}
|
||||||
save-state flip "up"
|
save-state flip "$current"
|
||||||
}
|
}
|
||||||
save-state flip "$current"
|
nuke-state flip
|
||||||
```
|
```
|
||||||
|
|
12
nuke-state
Executable file
12
nuke-state
Executable file
|
@ -0,0 +1,12 @@
|
||||||
|
#!/bin/execlineb
|
||||||
|
|
||||||
|
importas -ui name 1
|
||||||
|
importas -ui rdfd ELSTATE_${name}
|
||||||
|
backtick -E wrfd { s6-expr "$rdfd" + 1 }
|
||||||
|
|
||||||
|
fdclose ${rdfd}
|
||||||
|
fdclose ${wrfd}
|
||||||
|
|
||||||
|
shift
|
||||||
|
elgetpositionals
|
||||||
|
$@
|
Loading…
Reference in a new issue