cli/pkg/cmd/codespace/root.go
Jason Lunz f22be4a03d
use a more robust method to get the executable path
cmdutil.Factory.Executable() accounts for things like package managers
and symlinks to the actual executable.

An alternative to passing the *cmdutil.Factory down the stack would be
stashing the executable string in the codespace.App, which works (and
the diff is smaller), but it produced some odd non-local test failures.
This way seems less mysterious and more like other uses of Factory in
the codebase.
2021-12-20 13:57:52 -07:00

25 lines
585 B
Go

package codespace
import (
"github.com/cli/cli/v2/pkg/cmdutil"
"github.com/spf13/cobra"
)
func NewRootCmd(app *App, f *cmdutil.Factory) *cobra.Command {
root := &cobra.Command{
Use: "codespace",
Short: "Connect to and manage your codespaces",
}
root.AddCommand(newCodeCmd(app))
root.AddCommand(newCreateCmd(app))
root.AddCommand(newDeleteCmd(app))
root.AddCommand(newListCmd(app))
root.AddCommand(newLogsCmd(app))
root.AddCommand(newPortsCmd(app))
root.AddCommand(newSSHCmd(app, f))
root.AddCommand(newCpCmd(app))
root.AddCommand(newStopCmd(app))
return root
}