From 8efa2b8ac9157741be186ff3d6d619dc266fe38c Mon Sep 17 00:00:00 2001 From: Jan Heuermann Date: Mon, 6 Mar 2023 14:49:24 +0100 Subject: [PATCH] Minor fixes for release (#253) - Add `--no-style` option for `klog config` (to allow stdout>file redirection) - Improve help texts --- klog/app/cli/config.go | 12 ++++++++---- klog/app/cli/lib/args.go | 4 ++-- klog/app/cli/today.go | 3 ++- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/klog/app/cli/config.go b/klog/app/cli/config.go index 9f116bf..70298e1 100644 --- a/klog/app/cli/config.go +++ b/klog/app/cli/config.go @@ -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 { @@ -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") } diff --git a/klog/app/cli/lib/args.go b/klog/app/cli/lib/args.go index 31af948..27e99eb 100644 --- a/klog/app/cli/lib/args.go +++ b/klog/app/cli/lib/args.go @@ -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"` diff --git a/klog/app/cli/today.go b/klog/app/cli/today.go index a585a2d..99f9bef 100644 --- a/klog/app/cli/today.go +++ b/klog/app/cli/today.go @@ -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.)