Merge branch 'master' of github.com:AlekseyLobanov/gokeystat

This commit is contained in:
2016-03-27 02:32:52 +03:00

View File

@@ -241,12 +241,9 @@ func main() {
keyboardID := flag.Int("id", -1, "Your keyboard id") keyboardID := flag.Int("id", -1, "Your keyboard id")
outputPath := flag.String("o", "", "Path to export file") outputPath := flag.String("o", "", "Path to export file")
flag.Parse() flag.Parse()
log.Println("keyboardID =", *keyboardID, "outputPath =", *outputPath) log.Println("keyboardID =", *keyboardID, "outputPath =", *outputPath)
switch {
case *keyboardID == -1 && *outputPath == "":
flag.PrintDefaults()
return
case *keyboardID != -1:
// Opening database // Opening database
db, err := sql.Open("sqlite3", DATABASE_NAME) db, err := sql.Open("sqlite3", DATABASE_NAME)
if err != nil { if err != nil {
@@ -260,6 +257,12 @@ func main() {
InitDb(db, keyMap) InitDb(db, keyMap)
switch {
case *keyboardID == -1 && *outputPath == "":
flag.PrintDefaults()
return
case *keyboardID != -1:
cmd := exec.Command("xinput", "test", strconv.Itoa(*keyboardID)) cmd := exec.Command("xinput", "test", strconv.Itoa(*keyboardID))
stdout, err := cmd.StdoutPipe() stdout, err := cmd.StdoutPipe()
@@ -296,6 +299,7 @@ func main() {
time.Sleep(SLEEP_TIME) time.Sleep(SLEEP_TIME)
} }
case *outputPath != "": case *outputPath != "":
//exporting here exportingData := GetStatTimesFromDb(db, 0, keyMap) //exporting here
SaveToCsvFile(exportingData, keyMap, *outputPath, false)
} }
} }