diff --git a/README.md b/README.md index d9b5fa0..85a4aed 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,7 @@ color: "#46D9FF" webhook_url: "" notifications: true vab_msg: "Jag vabbar idag, försök hålla skutan flytande så är jag tillbaks imorgon" +weekend_msg: "Trevlig helg!" time_sheet: employee_id: "0000", path: "/home/burton/.butlerburton/" diff --git a/cfg/cfg.go b/cfg/cfg.go index 73db9d6..f3868b7 100644 --- a/cfg/cfg.go +++ b/cfg/cfg.go @@ -18,6 +18,7 @@ type Config struct { Notifications bool `yaml:"notifications"` VabMsg string `yaml:"vab_msg"` TimeSheet TimeSheet `yaml:"time_sheet"` + WeekEndMsg string `yaml:"weekend_msg"` } type TimeSheet struct { @@ -87,6 +88,7 @@ func createDefaultConfig(path string) { WebhookURL: "", Notifications: true, VabMsg: "Jag vabbar idag, försök hålla skutan flytande så är jag tillbaka imorgon", + WeekEndMsg: "Trevlig helg!", TimeSheet: TimeSheet{ EmployeeID: "0000", Path: os.Getenv("HOME") + "/.butlerburton/", diff --git a/cmd/checkoutCmd.go b/cmd/checkoutCmd.go index fdb209c..1c2d20e 100644 --- a/cmd/checkoutCmd.go +++ b/cmd/checkoutCmd.go @@ -103,3 +103,15 @@ func calculateOvertime(tci time.Duration) string { return "" } + +func WeekendCheckout(opts util.Options) error { + if opts.Loud { + util.SendTeamsMessage( + fmt.Sprintf("%s checkar ut", cfg.Cfg.Name), + cfg.Cfg.WeekEndMsg, + cfg.Cfg.Color, + cfg.Cfg.WebhookURL, + ) + } + return nil +} diff --git a/main.go b/main.go index 638994e..6bf22a1 100644 --- a/main.go +++ b/main.go @@ -26,6 +26,7 @@ func main() { Catered: false, Overtime: false, Vab: false, + Weekend: false, ShowStatus: false, Loud: false, } @@ -96,8 +97,18 @@ func main() { Usage: "write overtime to overtime column", Destination: &opts.Overtime, }, + &cli.BoolFlag{ + Name: "weekend", + Aliases: []string{"w"}, + Value: false, + Usage: "check out with weekend message", + Destination: &opts.Weekend, + }, }, Action: func(c *cli.Context) error { + if opts.Weekend { + return cmd.WeekendCheckout(opts) + } return cmd.Checkout(opts) }, }, diff --git a/util/options.go b/util/options.go index ce056cd..baa2794 100644 --- a/util/options.go +++ b/util/options.go @@ -7,4 +7,5 @@ type Options struct { Vab bool ShowStatus bool Loud bool + Weekend bool }