Added notes to Entry and track command
This commit is contained in:
parent
25f526d036
commit
56ffde16fe
4 changed files with 8 additions and 1 deletions
|
@ -14,6 +14,7 @@ type Entry struct {
|
||||||
Finish time.Time `json:"finish,omitempty"`
|
Finish time.Time `json:"finish,omitempty"`
|
||||||
Project string `json:"project,omitempty"`
|
Project string `json:"project,omitempty"`
|
||||||
Task string `json:"task,omitempty"`
|
Task string `json:"task,omitempty"`
|
||||||
|
Notes string `json:"notes,omitempty"`
|
||||||
User string `json:"user,omitempty"`
|
User string `json:"user,omitempty"`
|
||||||
|
|
||||||
SHA1 string `json:"-"`
|
SHA1 string `json:"-"`
|
||||||
|
|
|
@ -3,6 +3,7 @@ package z
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
// "time"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
// "github.com/gookit/color"
|
// "github.com/gookit/color"
|
||||||
)
|
)
|
||||||
|
@ -23,7 +24,6 @@ var projectCmd = &cobra.Command{
|
||||||
user := GetCurrentUser()
|
user := GetCurrentUser()
|
||||||
projectName := args[0]
|
projectName := args[0]
|
||||||
|
|
||||||
|
|
||||||
project, err := database.GetProject(user, projectName)
|
project, err := database.GetProject(user, projectName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Printf("%s %+v\n", CharError, err)
|
fmt.Printf("%s %+v\n", CharError, err)
|
||||||
|
|
|
@ -12,6 +12,7 @@ var begin string
|
||||||
var finish string
|
var finish string
|
||||||
var project string
|
var project string
|
||||||
var task string
|
var task string
|
||||||
|
var notes string
|
||||||
|
|
||||||
var force bool
|
var force bool
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,10 @@ var trackCmd = &cobra.Command{
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if notes != "" {
|
||||||
|
newEntry.Notes = notes
|
||||||
|
}
|
||||||
|
|
||||||
isRunning := newEntry.Finish.IsZero()
|
isRunning := newEntry.Finish.IsZero()
|
||||||
|
|
||||||
_, err = database.AddEntry(user, newEntry, isRunning)
|
_, err = database.AddEntry(user, newEntry, isRunning)
|
||||||
|
@ -49,6 +53,7 @@ func init() {
|
||||||
trackCmd.Flags().StringVarP(&finish, "finish", "s", "", "Time the activity should finish at\n\nEither in the formats 16:00 / 4:00PM \nor relative to the current time, \ne.g. -0:15 (now minus 15 minutes), +1.50 (now plus 1:30h).\nMust be after --begin time.")
|
trackCmd.Flags().StringVarP(&finish, "finish", "s", "", "Time the activity should finish at\n\nEither in the formats 16:00 / 4:00PM \nor relative to the current time, \ne.g. -0:15 (now minus 15 minutes), +1.50 (now plus 1:30h).\nMust be after --begin time.")
|
||||||
trackCmd.Flags().StringVarP(&project, "project", "p", "", "Project to be assigned")
|
trackCmd.Flags().StringVarP(&project, "project", "p", "", "Project to be assigned")
|
||||||
trackCmd.Flags().StringVarP(&task, "task", "t", "", "Task to be assigned")
|
trackCmd.Flags().StringVarP(&task, "task", "t", "", "Task to be assigned")
|
||||||
|
trackCmd.Flags().StringVarP(¬es, "notes", "n", "", "Activity notes")
|
||||||
trackCmd.Flags().BoolVarP(&force, "force", "f", false, "Force begin tracking of a new task \neven though another one is still running \n(ONLY IF YOU KNOW WHAT YOU'RE DOING!)")
|
trackCmd.Flags().BoolVarP(&force, "force", "f", false, "Force begin tracking of a new task \neven though another one is still running \n(ONLY IF YOU KNOW WHAT YOU'RE DOING!)")
|
||||||
|
|
||||||
var err error
|
var err error
|
||||||
|
|
Loading…
Reference in a new issue