feat(deploy): init a new deploy command to deploy services from Compose file

This commit is contained in:
Pavel Sviderski
2025-03-12 20:37:01 +10:00
parent eb42082955
commit 7fc07ce4bd
2 changed files with 48 additions and 0 deletions
+47
View File
@@ -0,0 +1,47 @@
package main
import (
"context"
"fmt"
"github.com/spf13/cobra"
"uncloud/internal/cli"
)
type deployOptions struct {
//configPath string
services []string
//machines []string
//env []string
//envFile string
//projectDir string
cluster string
}
// NewDeployCommand creates a new command to deploy services from a Compose file.
func NewDeployCommand() *cobra.Command {
opts := deployOptions{}
cmd := &cobra.Command{
Use: "deploy [FLAGS] [SERVICE...]",
// TODO: remove WIP when the command is fully implemented.
Short: "WIP: Deploy services from a Compose file.",
RunE: func(cmd *cobra.Command, args []string) error {
uncli := cmd.Context().Value("cli").(*cli.CLI)
if len(args) > 0 {
opts.services = args
}
return deploy(cmd.Context(), uncli, opts)
},
}
cmd.Flags().StringVarP(&opts.cluster, "cluster", "c", "", "Name of the cluster to deploy to (default is the current cluster)")
return cmd
}
// deploy parses the compose file and deploys the services to the Uncloud cluster.
func deploy(ctx context.Context, uncli *cli.CLI, opts deployOptions) error {
return fmt.Errorf("not implemented")
}
+1
View File
@@ -43,6 +43,7 @@ func main() {
_ = cmd.MarkPersistentFlagFilename("uncloud-config", "toml")
cmd.AddCommand(
NewDeployCommand(),
caddy.NewRootCommand(),
dns.NewRootCommand(),
machine.NewRootCommand(),