cli/pkg/cmd/codespace/root.go
2026-04-17 11:50:24 +02:00

50 lines
1.1 KiB
Go

package codespace
import (
codespacesAPI "github.com/cli/cli/v2/internal/codespaces/api"
"github.com/cli/cli/v2/pkg/cmdutil"
"github.com/spf13/cobra"
)
type ghExecutable struct {
executablePath string
}
func (e *ghExecutable) Executable() string {
return e.executablePath
}
func NewCmdCodespace(f *cmdutil.Factory) *cobra.Command {
root := &cobra.Command{
Use: "codespace",
Short: "Connect to and manage codespaces",
Aliases: []string{"cs"},
GroupID: "core",
}
app := NewApp(
f.IOStreams,
&ghExecutable{executablePath: f.ExecutablePath},
codespacesAPI.New(f),
f.Browser,
f.Remotes,
)
root.AddCommand(newCodeCmd(app))
root.AddCommand(newCreateCmd(app))
root.AddCommand(newEditCmd(app))
root.AddCommand(newDeleteCmd(app))
root.AddCommand(newJupyterCmd(app))
root.AddCommand(newListCmd(app))
root.AddCommand(newViewCmd(app))
root.AddCommand(newLogsCmd(app))
root.AddCommand(newPortsCmd(app))
root.AddCommand(newSSHCmd(app))
root.AddCommand(newCpCmd(app))
root.AddCommand(newStopCmd(app))
root.AddCommand(newSelectCmd(app))
root.AddCommand(newRebuildCmd(app))
return root
}