No description
Find a file
2022-08-05 22:36:46 +02:00
init-state feat: initial commit 2022-08-05 21:19:57 +02:00
LICENSE feat: initial commit 2022-08-05 21:19:57 +02:00
load-state feat: initial commit 2022-08-05 21:19:57 +02:00
nuke-state feat: add nuke-state 2022-08-05 22:36:46 +02:00
README.md feat: add nuke-state 2022-08-05 22:36:46 +02:00
save-state feat: initial commit 2022-08-05 21:19:57 +02:00

execline-state

in spite of skarnet's "execline maintains no state"

a simple shift register built on piperw(1)

usage

init-state <name>
load-state <name> <target>
save-state <name> <value>
nuke-state <name>
#!/bin/execlineb

init-state flip
save-state flip "up"
foreground {
	forstdin -E line
		load-state flip current
		println "! state: $current"
		ifelse { s6-test "$line" = "flip" } {
			println "! flipping state"
			ifelse { s6-test "$current" = "up" } {
				save-state flip "down"
			}
			save-state flip "up"
		}
		save-state flip "$current"
}
nuke-state flip