MCPcopy Create free account
hub / github.com/celer-pkg/celer / doInit

Method doInit

cmds/cmd_init.go:55–76  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

53}
54
55func (i *initCmd) doInit() error {
56 i.url = strings.TrimSpace(i.url)
57 i.branch = strings.TrimSpace(i.branch)
58
59 // Initialize celer configuration.
60 if err := i.celer.Init(); err != nil {
61 return color.PrintError(err, "Failed to initialize celer.")
62 }
63
64 // Setup configuration repository.
65 if err := i.celer.CloneConf(i.url, i.branch, i.force); err != nil {
66 return color.PrintError(err, "Failed to setup configuration repository.")
67 }
68
69 if i.branch != "" {
70 color.PrintSuccess("Successfully initialized celer with repository: %s --branch %s", i.url, i.branch)
71 } else {
72 color.PrintSuccess("Successfully initialized celer with repository: %s", i.url)
73 }
74
75 return nil
76}
77
78func (i *initCmd) completion(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
79 var suggestions []string

Callers 1

CommandMethod · 0.95

Calls 4

PrintErrorFunction · 0.92
PrintSuccessFunction · 0.92
CloneConfMethod · 0.80
InitMethod · 0.65

Tested by

no test coverage detected