mirror of
https://github.com/Threnklyn/zeit.git
synced 2026-06-07 14:13:31 +02:00
Implemented appendProjectIDToTask flag
This commit is contained in:
+10
-3
@@ -1,15 +1,17 @@
|
||||
package z
|
||||
|
||||
import (
|
||||
"os"
|
||||
"fmt"
|
||||
"os"
|
||||
"time"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/shopspring/decimal"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var listTotalTime bool
|
||||
var listOnlyProjectsAndTasks bool
|
||||
var appendProjectIDToTask bool
|
||||
|
||||
var listCmd = &cobra.Command{
|
||||
Use: "list",
|
||||
@@ -69,14 +71,18 @@ var listCmd = &cobra.Command{
|
||||
fmt.Printf("%s %s\n", CharMore, project)
|
||||
|
||||
for task, _ := range projectsAndTasks[project] {
|
||||
if appendProjectIDToTask == true {
|
||||
fmt.Printf("%*s└── %s [%s]\n", 1, " ", task, project)
|
||||
} else {
|
||||
fmt.Printf("%*s└── %s\n", 1, " ", task)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
totalHours := decimal.NewFromInt(0);
|
||||
totalHours := decimal.NewFromInt(0)
|
||||
for _, entry := range filteredEntries {
|
||||
totalHours = totalHours.Add(entry.GetDuration())
|
||||
fmt.Printf("%s\n", entry.GetOutput(false))
|
||||
@@ -97,6 +103,7 @@ func init() {
|
||||
listCmd.Flags().StringVarP(&task, "task", "t", "", "Task to be listed")
|
||||
listCmd.Flags().BoolVar(&listTotalTime, "total", false, "Show total time of hours for listed activities")
|
||||
listCmd.Flags().BoolVar(&listOnlyProjectsAndTasks, "only-projects-and-tasks", false, "Only list projects and their tasks, no entries")
|
||||
listCmd.Flags().BoolVar(&appendProjectIDToTask, "append-project-id-to-task", false, "Append project ID to tasks in the list")
|
||||
|
||||
var err error
|
||||
database, err = InitDatabase()
|
||||
|
||||
Reference in New Issue
Block a user