Added export to csv
This commit is contained in:
15
src/main.go
15
src/main.go
@@ -241,11 +241,7 @@ func main() {
|
||||
outputPath := flag.String("o", "", "Path to export file")
|
||||
flag.Parse()
|
||||
log.Println("keyboardId =", *keyboardId, "outputPath =", *outputPath)
|
||||
switch {
|
||||
case *keyboardId == -1 && *outputPath == "":
|
||||
flag.PrintDefaults()
|
||||
return
|
||||
case *keyboardId != -1:
|
||||
|
||||
// Opening database
|
||||
db, err := sql.Open("sqlite3", DATABASE_NAME)
|
||||
if err != nil {
|
||||
@@ -257,6 +253,12 @@ func main() {
|
||||
|
||||
keyMap := GetKeymap()
|
||||
|
||||
switch {
|
||||
case *keyboardId == -1 && *outputPath == "":
|
||||
flag.PrintDefaults()
|
||||
return
|
||||
case *keyboardId != -1:
|
||||
|
||||
InitDb(db, keyMap)
|
||||
|
||||
cmd := exec.Command("xinput", "test", strconv.Itoa(*keyboardId))
|
||||
@@ -295,6 +297,7 @@ func main() {
|
||||
time.Sleep(SLEEP_TIME)
|
||||
}
|
||||
case *outputPath != "":
|
||||
//exporting here
|
||||
exportingData := GetStatTimesFromDb(db, 0, keyMap) //exporting here
|
||||
SaveToCsvFile(exportingData, keyMap, *outputPath, false)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user