-
Notifications
You must be signed in to change notification settings - Fork 0
/
day02.go
48 lines (41 loc) · 1.03 KB
/
day02.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/*
Copyright © 2022 NAME HERE <EMAIL ADDRESS>
*/
package cmd
import (
"fmt"
"github.com/spf13/cobra"
"github.com/bobbyrward/adventofcode2022/go/adventofcode/pkg/problems/day02"
"github.com/bobbyrward/adventofcode2022/go/adventofcode/pkg/solver"
)
// day02Cmd represents the day02 command
var day02Cmd = &cobra.Command{
Use: "day02",
}
// problem01Cmd represents the problem01 command
var day02problem01Cmd = &cobra.Command{
Use: "problem01",
RunE: func(cmd *cobra.Command, args []string) error {
err := solver.Solve("day02", day02.NewProblem01())
if err != nil {
fmt.Printf("Error: %v\n", err)
}
return err
},
}
// problem01Cmd represents the problem01 command
var day02problem02Cmd = &cobra.Command{
Use: "problem02",
RunE: func(cmd *cobra.Command, args []string) error {
err := solver.Solve("day02", day02.NewProblem02())
if err != nil {
fmt.Printf("Error: %v\n", err)
}
return err
},
}
func init() {
day02Cmd.AddCommand(day02problem01Cmd)
day02Cmd.AddCommand(day02problem02Cmd)
rootCmd.AddCommand(day02Cmd)
}