MCPcopy Create free account
hub / github.com/Thunder-Compute/thunder-cli / resolveTemplateAlias

Function resolveTemplateAlias

cmd/create.go:118–128  ·  view source on GitHub ↗

resolveTemplateAlias reconciles --template and --snapshot. They're aliases, so using both with different values is an error; using only --snapshot copies its value into the shared template var.

(cmd *cobra.Command)

Source from the content-addressed store, hash-verified

116// so using both with different values is an error; using only --snapshot copies
117// its value into the shared template var.
118func resolveTemplateAlias(cmd *cobra.Command) error {
119 templateSet := cmd.Flags().Changed("template")
120 snapshotSet := cmd.Flags().Changed("snapshot")
121 if templateSet && snapshotSet && template != snapshotAlias {
122 return usageErr("--template and --snapshot are aliases; use only one")
123 }
124 if snapshotSet && !templateSet {
125 template = snapshotAlias
126 }
127 return nil
128}
129
130func hasAllCreateFlags(cmd *cobra.Command) bool {
131 return len(missingCreateFlags(cmd)) == 0

Callers 1

runCreateFunction · 0.85

Calls 1

usageErrFunction · 0.85

Tested by

no test coverage detected