commands

package
v0.0.0-...-7841a0e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 23, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GenerateReportCmd = &cobra.Command{
	Use:     "generate-report",
	Aliases: []string{"gr"},
	Short:   "Generate reports on a month",
	Long:    "Given a month, generate a report on the payouts for anyone who was oncall.",
	Args:    cobra.NoArgs,
	RunE: func(cmd *cobra.Command, args []string) error {
		client, err := config.BuildPDClient()
		if err != nil {
			return err
		}

		govUK := govuk.New()

		app := app.New(client, govUK)

		timeIn, err := convMonthToMonth(TimeIn)
		if err != nil {
			if Verbose {
				cmd.Printf("%+v\n", timeIn)
			}
			return err
		}

		if err := app.GetBankHolidays(context.Background(), timeIn.Year()); err != nil {
			return err
		}

		rota, debug, err := app.GenerateRota(ScheduleIDs, timeIn.Year(), timeIn.Month())
		if err != nil {
			if Verbose {
				cmd.Printf("%+v\n", debug)
			}
			return err
		}

		cmd.Printf("\n")
		cmd.Println(app.StringifyRota(rota))

		return nil
	},
}
View Source
var ScheduleIDs []string
View Source
var TimeIn string
View Source
var Verbose bool

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL