admin: implement sync-time and buzzer commands

master
S.J.R. van Schaik 7 years ago
parent 78ebcafaea
commit 55b4590779
  1. 13
      admin/main.go

@ -5,6 +5,8 @@ import (
"fmt"
"log"
"os"
"strconv"
"time"
)
type CommandFunc func(tbm *TBM, args []string) error
@ -23,9 +25,11 @@ var (
"rmdir": cmd_rmdir,
"date": cmd_date,
"set-date": cmd_set_date,
"sync-time" : cmd_sync_time,
"time": cmd_time,
"write": cmd_write,
"append": cmd_append,
"buzzer": cmd_buzzer,
}
)
@ -82,6 +86,11 @@ func cmd_time(tbm *TBM, args []string) error {
return cmd_generic(tbm, "time", args, nil)
}
func cmd_sync_time(tbm *TBM, args []string) error {
return cmd_generic(tbm, "set-time", []string{strconv.FormatInt(
time.Now().Unix(), 10)}, nil)
}
func cmd_write(tbm *TBM, args []string) error {
f, _ := os.Open(args[0])
defer f.Close()
@ -127,6 +136,10 @@ func cmd_append(tbm *TBM, args []string) error {
}
}
func cmd_buzzer(tbm *TBM, args []string) error {
cmd_generic(tbm, "buzzer", args, nil)
}
func main() {
flag.Parse()

Loading…
Cancel
Save