diff --git a/args.go b/args.go index 9953cedb..2acf06df 100644 --- a/args.go +++ b/args.go @@ -42,6 +42,7 @@ type arguments struct { Eval *bool Condensed *bool IgnoreWarnings *bool + Time *string } var args = arguments{ @@ -188,6 +189,10 @@ var args = arguments{ "duration", defaults.Duration, comments("The elapsed clock-time of the previous command")), + Time: flag.String( + "time", + defaults.Time, + comments("The elapsed clock-time of the previous command")), DurationMin: flag.String( "duration-min", defaults.DurationMin, diff --git a/config.go b/config.go index 24317e25..574d7a58 100644 --- a/config.go +++ b/config.go @@ -52,6 +52,7 @@ type Config struct { Modes SymbolMap `json:"modes"` Shells ShellMap `json:"shells"` Themes ThemeMap `json:"themes"` + Time string `json:"-"` } func (mode *SymbolTemplate) UnmarshalJSON(data []byte) error { diff --git a/defaults.go b/defaults.go index 7c95c165..d64bf7e9 100644 --- a/defaults.go +++ b/defaults.go @@ -1626,6 +1626,7 @@ var defaults = Config{ NixShellBg: gruvbox_faded_purple, }, }, + Time: "15:04:05", } const ( diff --git a/main.go b/main.go index 727d9b29..5b64709f 100644 --- a/main.go +++ b/main.go @@ -200,6 +200,8 @@ func main() { cfg.Condensed = *args.Condensed case "ignore-warnings": cfg.IgnoreWarnings = *args.IgnoreWarnings + case "time": + cfg.Time = *args.Time } }) diff --git a/segment-time.go b/segment-time.go index e5c49730..633d3fe2 100644 --- a/segment-time.go +++ b/segment-time.go @@ -1,6 +1,7 @@ package main import ( + "strings" pwl "github.com/justjanne/powerline-go/powerline" "time" ) @@ -8,7 +9,7 @@ import ( func segmentTime(p *powerline) []pwl.Segment { return []pwl.Segment{{ Name: "time", - Content: time.Now().Format("15:04:05"), + Content: time.Now().Format(strings.TrimSpace(p.cfg.Time)), Foreground: p.theme.TimeFg, Background: p.theme.TimeBg, }}