Mount gh codespace command

This commit is contained in:
Mislav Marohnić 2021-09-28 16:58:29 +02:00
parent f749590e87
commit 7673622830
2 changed files with 14 additions and 0 deletions

1
go.mod
View file

@ -45,3 +45,4 @@ require (
)
replace github.com/shurcooL/graphql => github.com/cli/shurcooL-graphql v0.0.0-20200707151639-0f7232a2bf7e
replace golang.org/x/crypto => ./internal/crypto

View file

@ -2,8 +2,12 @@ package root
import (
"net/http"
"os"
"github.com/MakeNowJust/heredoc"
"github.com/cli/cli/v2/cmd/ghcs"
"github.com/cli/cli/v2/cmd/ghcs/output"
ghcsApi "github.com/cli/cli/v2/internal/api"
actionsCmd "github.com/cli/cli/v2/pkg/cmd/actions"
aliasCmd "github.com/cli/cli/v2/pkg/cmd/alias"
apiCmd "github.com/cli/cli/v2/pkg/cmd/api"
@ -105,6 +109,15 @@ func NewCmdRoot(f *cmdutil.Factory, version, buildDate string) *cobra.Command {
referenceCmd.SetHelpFunc(referenceHelpFn(f.IOStreams))
cmd.AddCommand(referenceCmd)
ghcsApp := ghcs.NewApp(
output.NewLogger(f.IOStreams.Out, f.IOStreams.ErrOut, !f.IOStreams.IsStdoutTTY()),
ghcsApi.New(os.Getenv("GITHUB_TOKEN"), http.DefaultClient),
)
ghcsCmd := ghcs.NewRootCmd(ghcsApp)
ghcsCmd.Use = "codespace"
ghcsCmd.Aliases = []string{"cs"}
cmd.AddCommand(ghcsCmd)
cmdutil.DisableAuthCheck(cmd)
// this needs to appear last: