You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ptrcnull 58ac4a8b6b docs: add requirements 4 days ago
LICENSE feat: initial commit 4 days ago
README.md docs: add requirements 4 days ago
init-state feat: initial commit 4 days ago
load-state feat: initial commit 4 days ago
nuke-state feat: add nuke-state 4 days ago
save-state feat: initial commit 4 days ago

README.md

execline-state

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

a simple shift register built on piperw(1)

requirements:

  • execline (obviously)
  • s6-portable-utils (s6-expr, s6-ls, s6-tail)

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