Skip to content

Commit

Permalink
Minor fixes for release (#253)
Browse files Browse the repository at this point in the history
- Add `--no-style` option for `klog config` (to allow stdout>file
redirection)
- Improve help texts
  • Loading branch information
jotaen authored Mar 6, 2023
1 parent 34acd3b commit 8efa2b8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
12 changes: 8 additions & 4 deletions klog/app/cli/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (

type Config struct {
ConfigFilePath bool `name:"file-path" help:"Prints the path to your config file"`
lib.NoStyleArgs
}

func (opt *Config) Help() string {
Expand All @@ -19,18 +20,21 @@ You may use the output as template for setting up your config file, as its forma
}

func (opt *Config) Run(ctx app.Context) app.Error {
opt.NoStyleArgs.Apply(&ctx)
if opt.ConfigFilePath {
ctx.Print(app.Join(ctx.KlogConfigFolder(), app.CONFIG_FILE_NAME).Path() + "\n")
return nil
}
for i, e := range app.CONFIG_FILE_ENTRIES {
ctx.Print(lib.Subdued.Format(lib.Reflower.Reflow(e.Help.Summary, []string{"# "})))
ctx.Print(ctx.Serialiser().Format(lib.Subdued, lib.Reflower.Reflow(e.Help.Summary, []string{"# "})))
ctx.Print("\n")
ctx.Print(lib.Subdued.Format(lib.Reflower.Reflow("Value: "+e.Help.Value, []string{"# - ", "# "})))
ctx.Print(ctx.Serialiser().Format(lib.Subdued, lib.Reflower.Reflow("Value: "+e.Help.Value, []string{"# - ", "# "})))
ctx.Print("\n")
ctx.Print(lib.Subdued.Format(lib.Reflower.Reflow("Default: "+e.Help.Default, []string{"# - ", "# "})))
ctx.Print(ctx.Serialiser().Format(lib.Subdued, lib.Reflower.Reflow("Default: "+e.Help.Default, []string{"# - ", "# "})))
ctx.Print("\n")
ctx.Print(lib.Red.Format(e.Name) + ` = ` + terminalformat.Style{Color: "227"}.Format(e.Value(ctx.Config())))
ctx.Print(ctx.Serialiser().Format(lib.Red, e.Name))
ctx.Print(" = ")
ctx.Print(ctx.Serialiser().Format(terminalformat.Style{Color: "227"}, e.Value(ctx.Config())))
if i < len(app.CONFIG_FILE_ENTRIES)-1 {
ctx.Print("\n\n")
}
Expand Down
4 changes: 2 additions & 2 deletions klog/app/cli/lib/args.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,8 @@ type FilterArgs struct {
Today bool `name:"today" group:"Filter" help:"Records at today’s date"`
Yesterday bool `name:"yesterday" group:"Filter" help:"Records at yesterday’s date"`
Tomorrow bool `name:"tomorrow" group:"Filter" help:"Records at tomorrow’s date"`
ThisXXX bool `name:"this-***" group:"Filter" help:"Records of this week/month/quarter/year"`
LastXXX bool `name:"last-***" group:"Filter" help:"Records of last week/month/quarter/year"`
ThisXXX bool `name:"this-***" group:"Filter" help:"Records of this week/month/quarter/year, e.g. --this-week"`
LastXXX bool `name:"last-***" group:"Filter" help:"Records of last week/month/quarter/year, e.g. --last-month"`
ThisWeek bool `hidden:"" name:"this-week" group:"Filter"`
ThisWeekAlias bool `hidden:"" name:"thisweek" group:"Filter"`
LastWeek bool `hidden:"" name:"last-week" group:"Filter"`
Expand Down
3 changes: 2 additions & 1 deletion klog/app/cli/today.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ type Today struct {
}

func (opt *Today) Help() string {
return `Evaluates the total time, separately for today’s records and all other records.
return `Convenience command to “check in” on the current day.
It evaluates the total time separately for today’s records and all other records.
When both --now and --diff are set, it also calculates the forecasted end-time at which the time goal will be reached.
(I.e. when the difference between should and actual time will be 0.)
Expand Down

0 comments on commit 8efa2b8

Please sign in to comment.