Skip to content

Commit

Permalink
display: actually support giving sheet name
Browse files Browse the repository at this point in the history
Also show error when given sheet does not exist.
  • Loading branch information
lieuwex committed Jan 14, 2020
1 parent 37338b9 commit cc15b55
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions main.go
Expand Up @@ -211,7 +211,7 @@ func main() {
})

commands.AddCommand("display", "show all entries in the given sheet", "[SHEET/all/full (current)]", func() error {
var sheet string
sheet := input.Note
switch input.Note {
case "":
sheet = state.CurrentSheet
Expand All @@ -224,7 +224,11 @@ func main() {
return err
}

fmt.Printf("Timesheet: %s\n", state.CurrentSheet)
if len(entries) == 0 {
return fmt.Errorf("Can't find sheet matching \"%s\"", sheet)
}

fmt.Printf("Timesheet: %s\n", sheet)
w := tabwriter.NewWriter(os.Stdout, 0, 0, 3, ' ', 0)

fmt.Fprintln(w, "Id\tDay\tStart End\tDuration\tNotes")
Expand Down

0 comments on commit cc15b55

Please sign in to comment.