-
Notifications
You must be signed in to change notification settings - Fork 15
/
plan.go
35 lines (27 loc) · 888 Bytes
/
plan.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
package sync
import (
"fmt"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"github.com/kaskada-ai/kaskada/clients/cli/api"
"github.com/kaskada-ai/kaskada/clients/cli/utils"
)
// planCmd represents the plan command
var planCmd = &cobra.Command{
Use: "plan",
Short: "diffs the current state of the system against the configuration in the provided spec file(s)",
Run: func(cmd *cobra.Command, args []string) {
log.Info().Msg("starting plan")
if len(planFiles) == 0 {
utils.LogAndQuitIfErrorExists(fmt.Errorf("at least one `file` flag must be set"))
}
apiClient := api.NewApiClient()
_, err := plan(apiClient, planFiles)
utils.LogAndQuitIfErrorExists(err)
log.Info().Msg("Success!")
},
}
var planFiles []string
func init() {
planCmd.Flags().StringArrayVarP(&planFiles, "file", "f", []string{}, "specify one or more file-paths of yaml spec files")
}