tsinkf

command module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 9, 2014 License: BSD-2-Clause Imports: 12 Imported by: 0

README

tsinkf Build Status

Stateful command execution

Motivation

Sometimes you want to perform command exactly once. Tsinkf keeps track what commands have been executed and their results

Install

Install Go 1, either from source or with a prepackaged binary. Then,

$ go get github.com/brapse/tsinkf

Usage

Execute tsinkf run followed by a command.

Running:

$ tsinkf run wc -l /usr/share/dict/words
2013-04-24 22:43:58     NEW->RUNNING    wc -l /usr/share/dict/words d2MgLWwgL3Vzci9zaGFyZS9kaWN0L3dvcmRz
2013-04-24 22:43:58     RUNNING->SUCCEEDED      wc -l /usr/share/dict/words     d2MgLWwgL3Vzci9zaGFyZS9kaWN0L3dvcmRz 

Performing the command again will result in no output because the input domain has been executed successfully. Behind the scenes tsink will persist the result of the commands to disk (.tsinkf/ by default).

$ tsinkf run wc -l /usr/share/dict/words

tsinkf show can be used to inspect the state (.tsinkf/ by default). The output contains the completion time, the state, the command and the jobID (base64 version of the command).

$ tsinkf show
2013-04-24 22:43:58     SUCCEEDED       wc -l /usr/share/dict/words d2MgLWwgL3Vzci9zaGFyZS9kaWN0L3dvcmRz

A specific job can be inspected and output shown by including the -v flag along with the jobID as parameters to tsinkf show.

$ tsinkf show -v d2MgLWwgL3Vzci9zaGFyZS9kaWN0L3dvcmRz
2013-04-24 22:43:58     SUCCEEDED     wc -l /usr/share/dict/words d2MgLWwgL3Vzci9zaGFyZS9kaWN0L3dvcmRz
235886 /usr/share/dict/words

Running tsinkf reset will reset the state of all the jobs. Subsequent executions will append their output to the original output.

$ tsinkf reset -v
2013-04-24 22:48:25     SUCCEEDED->NEW  wc -l /usr/share/dict/words d2MgLWwgL3Vzci9zaGFyZS9kaWN0L3dvcmRz

Status

  • Beta quality
  • Not used in production
  • Some features and sketches and not fully fleshed out

Todo

  • tsink reset -hard #=> delete the contents
  • Redo the help and subcommand listing
  • Refactor output redirecting

License

BSD 2-Clause, see LICENSE for more details.

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