sate

command module
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 17, 2022 License: MIT Imports: 13 Imported by: 0

README

sate

Stupid state manager using tcp server.

Basic usage

Config

Default path config is ~/.config/sate/state.yml, you can set path config using -c or --config flag.

# ~/.config/sate/state.yml
host: "localhost" # default localhost
port: 9123 # default 9123
states:
    simple:
        default: "foo" # default value
    complex:
        default: "bye"
        initial: "echo replaced" # execute after parse the yaml config and store the result
        get: 'echo "state: %s"' # execute when get state and send the result
        set: "echo %s | tr a-z A-Z" # execute when set state and store the result
        onget: # execute when get state
            - "notify-send sate-get %s"
        onset: # execute when set state
            - "notify-send sate-set %s"
    counter:
        default: "23"
        dispatch:
            increases: "echo $((%s+1))"
            decreases: "echo $((%s-1))"
Start server
# Start normal server with daemon.
sate start
# Start server with custom config.
sate start -c "path to config"
# Start without daemon, good for debugging.
sate start -n
Get state
sate get "simple"
Set state
sate set "complex" "uppercase"
Dispatch state
sate dispatch "counter" "increases"
Watch state changes
sate watch "simple"

TODO

  • Hot reload config.
  • Dispatch command.
  • Support space value.

Contribute

  • Fork.
  • Add something.
  • Describe changes in changelog.md.
  • Commit.
  • Push.
  • Pull request.

Dependency

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL