adding the sources
This commit is contained in:
parent
1caa7b987f
commit
c7eb842ec7
3 changed files with 138 additions and 0 deletions
44
lockout/main.go
Normal file
44
lockout/main.go
Normal file
|
@ -0,0 +1,44 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/vbatts/go-lockout/config"
|
||||
"os"
|
||||
)
|
||||
|
||||
func main() {
|
||||
var (
|
||||
c *config.Config
|
||||
err error
|
||||
)
|
||||
|
||||
c, err = config.ReadConfig(DefaultConfig)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "ERROR: %s\n", err)
|
||||
fmt.Fprintf(os.Stderr, UsageMessage)
|
||||
os.Exit(1)
|
||||
}
|
||||
//fmt.Printf("%#v\n", c)
|
||||
|
||||
err = c.Lock()
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "ERROR: %s\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
err = c.Suspend()
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "ERROR: %s\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
var (
|
||||
DefaultConfig = os.Getenv("HOME") + "/.config/lockout.conf"
|
||||
UsageMessage = `
|
||||
Please configure this file to look something like
|
||||
|
||||
suspendcmd: sudo /usr/sbin/pm-suspend
|
||||
lockcmd: xscreensaver-command -lock
|
||||
|
||||
`
|
||||
)
|
Loading…
Add table
Add a link
Reference in a new issue