Merge pull request #107 from github/spelling-again
use correct correct spelling of codespace
This commit is contained in:
commit
65c19a3317
10 changed files with 51 additions and 51 deletions
|
|
@ -282,7 +282,7 @@ func (a *API) StartCodespace(ctx context.Context, token string, codespace *Codes
|
|||
// HTTP 503 with error code 7 (EnvironmentNotShutdown) is benign.
|
||||
// Ignore it.
|
||||
} else {
|
||||
return fmt.Errorf("failed to start Codespace: %s", b)
|
||||
return fmt.Errorf("failed to start codespace: %s", b)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -330,7 +330,7 @@ type SKU struct {
|
|||
func (a *API) GetCodespacesSKUs(ctx context.Context, user *User, repository *Repository, branch, location string) ([]*SKU, error) {
|
||||
req, err := http.NewRequest(http.MethodGet, githubAPI+"/vscs_internal/user/"+user.Login+"/skus", nil)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("err creating request: %v", err)
|
||||
return nil, fmt.Errorf("error creating request: %v", err)
|
||||
}
|
||||
|
||||
q := req.URL.Query()
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ func newCodeCmd() *cobra.Command {
|
|||
|
||||
codeCmd := &cobra.Command{
|
||||
Use: "code [<codespace>]",
|
||||
Short: "Open a Codespace in VS Code",
|
||||
Short: "Open a codespace in VS Code",
|
||||
Args: cobra.MaximumNArgs(1),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
var codespaceName string
|
||||
|
|
@ -52,14 +52,14 @@ func code(codespaceName string, useInsiders bool) error {
|
|||
if err == codespaces.ErrNoCodespaces {
|
||||
return err
|
||||
}
|
||||
return fmt.Errorf("error choosing Codespace: %v", err)
|
||||
return fmt.Errorf("error choosing codespace: %v", err)
|
||||
}
|
||||
codespaceName = codespace.Name
|
||||
}
|
||||
|
||||
url := vscodeProtocolURL(codespaceName, useInsiders)
|
||||
if err := open.Run(url); err != nil {
|
||||
return fmt.Errorf("error opening vscode URL %s: %s. (Is VSCode installed?)", url, err)
|
||||
return fmt.Errorf("error opening vscode URL %s: %s. (Is VS Code installed?)", url, err)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ func newCreateCmd() *cobra.Command {
|
|||
|
||||
createCmd := &cobra.Command{
|
||||
Use: "create",
|
||||
Short: "Create a Codespace",
|
||||
Short: "Create a codespace",
|
||||
Args: cobra.NoArgs,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
return create(opts)
|
||||
|
|
@ -69,12 +69,12 @@ func create(opts *createOptions) error {
|
|||
|
||||
locationResult := <-locationCh
|
||||
if locationResult.Err != nil {
|
||||
return fmt.Errorf("error getting Codespace region location: %v", locationResult.Err)
|
||||
return fmt.Errorf("error getting codespace region location: %v", locationResult.Err)
|
||||
}
|
||||
|
||||
userResult := <-userCh
|
||||
if userResult.Err != nil {
|
||||
return fmt.Errorf("error getting Codespace user: %v", userResult.Err)
|
||||
return fmt.Errorf("error getting codespace user: %v", userResult.Err)
|
||||
}
|
||||
|
||||
machine, err := getMachineName(ctx, opts.machine, userResult.User, repository, branch, locationResult.Location, apiClient)
|
||||
|
|
@ -85,11 +85,11 @@ func create(opts *createOptions) error {
|
|||
return errors.New("There are no available machine types for this repository")
|
||||
}
|
||||
|
||||
log.Println("Creating your Codespace...")
|
||||
log.Println("Creating your codespace...")
|
||||
|
||||
codespace, err := apiClient.CreateCodespace(ctx, userResult.User, repository, machine, branch, locationResult.Location)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error creating Codespace: %v", err)
|
||||
return fmt.Errorf("error creating codespace: %v", err)
|
||||
}
|
||||
|
||||
if opts.showStatus {
|
||||
|
|
@ -154,7 +154,7 @@ func showStatus(ctx context.Context, log *output.Logger, apiClient *api.API, use
|
|||
}
|
||||
|
||||
if err := codespaces.PollPostCreateStates(ctx, log, apiClient, user, codespace, poller); err != nil {
|
||||
return fmt.Errorf("failed to poll state changes from Codespace: %v", err)
|
||||
return fmt.Errorf("failed to poll state changes from codespace: %v", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
|
@ -228,7 +228,7 @@ func getBranchName(branch string) (string, error) {
|
|||
func getMachineName(ctx context.Context, machine string, user *api.User, repo *api.Repository, branch, location string, apiClient *api.API) (string, error) {
|
||||
skus, err := apiClient.GetCodespacesSKUs(ctx, user, repo, branch, location)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("error getting Codespace SKUs: %v", err)
|
||||
return "", fmt.Errorf("error requesting machine instance types: %v", err)
|
||||
}
|
||||
|
||||
// if user supplied a machine type, it must be valid
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ import (
|
|||
func newDeleteCmd() *cobra.Command {
|
||||
deleteCmd := &cobra.Command{
|
||||
Use: "delete [<codespace>]",
|
||||
Short: "Delete a Codespace",
|
||||
Short: "Delete a codespace",
|
||||
Args: cobra.MaximumNArgs(1),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
var codespaceName string
|
||||
|
|
@ -28,7 +28,7 @@ func newDeleteCmd() *cobra.Command {
|
|||
|
||||
deleteAllCmd := &cobra.Command{
|
||||
Use: "all",
|
||||
Short: "Delete all Codespaces for the current user",
|
||||
Short: "Delete all codespaces for the current user",
|
||||
Args: cobra.NoArgs,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
return deleteAll()
|
||||
|
|
@ -37,7 +37,7 @@ func newDeleteCmd() *cobra.Command {
|
|||
|
||||
deleteByRepoCmd := &cobra.Command{
|
||||
Use: "repo <repo>",
|
||||
Short: "Delete all Codespaces for a repository",
|
||||
Short: "Delete all codespaces for a repository",
|
||||
Args: cobra.ExactArgs(1),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
return deleteByRepo(args[0])
|
||||
|
|
@ -65,11 +65,11 @@ func delete_(codespaceName string) error {
|
|||
|
||||
codespace, token, err := codespaces.GetOrChooseCodespace(ctx, apiClient, user, codespaceName)
|
||||
if err != nil {
|
||||
return fmt.Errorf("get or choose Codespace: %v", err)
|
||||
return fmt.Errorf("get or choose codespace: %v", err)
|
||||
}
|
||||
|
||||
if err := apiClient.DeleteCodespace(ctx, user, token, codespace.Name); err != nil {
|
||||
return fmt.Errorf("error deleting Codespace: %v", err)
|
||||
return fmt.Errorf("error deleting codespace: %v", err)
|
||||
}
|
||||
|
||||
log.Println("Codespace deleted.")
|
||||
|
|
@ -89,17 +89,17 @@ func deleteAll() error {
|
|||
|
||||
codespaces, err := apiClient.ListCodespaces(ctx, user)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error getting Codespaces: %v", err)
|
||||
return fmt.Errorf("error getting codespaces: %v", err)
|
||||
}
|
||||
|
||||
for _, c := range codespaces {
|
||||
token, err := apiClient.GetCodespaceToken(ctx, user.Login, c.Name)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error getting Codespace token: %v", err)
|
||||
return fmt.Errorf("error getting codespace token: %v", err)
|
||||
}
|
||||
|
||||
if err := apiClient.DeleteCodespace(ctx, user, token, c.Name); err != nil {
|
||||
return fmt.Errorf("error deleting Codespace: %v", err)
|
||||
return fmt.Errorf("error deleting codespace: %v", err)
|
||||
}
|
||||
|
||||
log.Printf("Codespace deleted: %s\n", c.Name)
|
||||
|
|
@ -120,7 +120,7 @@ func deleteByRepo(repo string) error {
|
|||
|
||||
codespaces, err := apiClient.ListCodespaces(ctx, user)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error getting Codespaces: %v", err)
|
||||
return fmt.Errorf("error getting codespaces: %v", err)
|
||||
}
|
||||
|
||||
var deleted bool
|
||||
|
|
@ -132,18 +132,18 @@ func deleteByRepo(repo string) error {
|
|||
|
||||
token, err := apiClient.GetCodespaceToken(ctx, user.Login, c.Name)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error getting Codespace token: %v", err)
|
||||
return fmt.Errorf("error getting codespace token: %v", err)
|
||||
}
|
||||
|
||||
if err := apiClient.DeleteCodespace(ctx, user, token, c.Name); err != nil {
|
||||
return fmt.Errorf("error deleting Codespace: %v", err)
|
||||
return fmt.Errorf("error deleting codespace: %v", err)
|
||||
}
|
||||
|
||||
log.Printf("Codespace deleted: %s\n", c.Name)
|
||||
}
|
||||
|
||||
if !deleted {
|
||||
return fmt.Errorf("No Codespace was found for repository: %s", repo)
|
||||
return fmt.Errorf("No codespace was found for repository: %s", repo)
|
||||
}
|
||||
|
||||
return list(&listOptions{})
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ func newListCmd() *cobra.Command {
|
|||
|
||||
listCmd := &cobra.Command{
|
||||
Use: "list",
|
||||
Short: "List your Codespaces",
|
||||
Short: "List your codespaces",
|
||||
Args: cobra.NoArgs,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
return list(opts)
|
||||
|
|
@ -46,7 +46,7 @@ func list(opts *listOptions) error {
|
|||
|
||||
codespaces, err := apiClient.ListCodespaces(ctx, user)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error getting Codespaces: %v", err)
|
||||
return fmt.Errorf("error getting codespaces: %v", err)
|
||||
}
|
||||
|
||||
table := output.NewTable(os.Stdout, opts.asJSON)
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ func newLogsCmd() *cobra.Command {
|
|||
|
||||
logsCmd := &cobra.Command{
|
||||
Use: "logs [<codespace>]",
|
||||
Short: "Access Codespace logs",
|
||||
Short: "Access codespace logs",
|
||||
Args: cobra.MaximumNArgs(1),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
var codespaceName string
|
||||
|
|
@ -51,7 +51,7 @@ func logs(ctx context.Context, tail bool, codespaceName string) error {
|
|||
|
||||
codespace, token, err := codespaces.GetOrChooseCodespace(ctx, apiClient, user, codespaceName)
|
||||
if err != nil {
|
||||
return fmt.Errorf("get or choose Codespace: %v", err)
|
||||
return fmt.Errorf("get or choose codespace: %v", err)
|
||||
}
|
||||
|
||||
lsclient, err := codespaces.ConnectToLiveshare(ctx, log, apiClient, user.Login, token, codespace)
|
||||
|
|
|
|||
|
|
@ -35,14 +35,14 @@ func newPortsCmd() *cobra.Command {
|
|||
|
||||
portsCmd := &cobra.Command{
|
||||
Use: "ports",
|
||||
Short: "List ports in a Codespace",
|
||||
Short: "List ports in a codespace",
|
||||
Args: cobra.NoArgs,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
return ports(opts)
|
||||
},
|
||||
}
|
||||
|
||||
portsCmd.Flags().StringVarP(&opts.codespaceName, "codespace", "c", "", "The `name` of the Codespace to use")
|
||||
portsCmd.Flags().StringVarP(&opts.codespaceName, "codespace", "c", "", "The `name` of the codespace to use")
|
||||
portsCmd.Flags().BoolVar(&opts.asJSON, "json", false, "Output as JSON")
|
||||
|
||||
portsCmd.AddCommand(newPortsPublicCmd())
|
||||
|
|
@ -71,7 +71,7 @@ func ports(opts *portsOptions) error {
|
|||
if err == codespaces.ErrNoCodespaces {
|
||||
return err
|
||||
}
|
||||
return fmt.Errorf("error choosing Codespace: %v", err)
|
||||
return fmt.Errorf("error choosing codespace: %v", err)
|
||||
}
|
||||
|
||||
devContainerCh := getDevContainer(ctx, apiClient, codespace)
|
||||
|
|
@ -211,12 +211,12 @@ func updatePortVisibility(log *output.Logger, codespaceName, sourcePort string,
|
|||
|
||||
token, err := apiClient.GetCodespaceToken(ctx, user.Login, codespaceName)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error getting Codespace token: %v", err)
|
||||
return fmt.Errorf("error getting codespace token: %v", err)
|
||||
}
|
||||
|
||||
codespace, err := apiClient.GetCodespace(ctx, token, user.Login, codespaceName)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error getting Codespace: %v", err)
|
||||
return fmt.Errorf("error getting codespace: %v", err)
|
||||
}
|
||||
|
||||
lsclient, err := codespaces.ConnectToLiveshare(ctx, log, apiClient, user.Login, token, codespace)
|
||||
|
|
@ -277,12 +277,12 @@ func forwardPorts(log *output.Logger, codespaceName string, ports []string) erro
|
|||
|
||||
token, err := apiClient.GetCodespaceToken(ctx, user.Login, codespaceName)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error getting Codespace token: %v", err)
|
||||
return fmt.Errorf("error getting codespace token: %v", err)
|
||||
}
|
||||
|
||||
codespace, err := apiClient.GetCodespace(ctx, token, user.Login, codespaceName)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error getting Codespace: %v", err)
|
||||
return fmt.Errorf("error getting codespace: %v", err)
|
||||
}
|
||||
|
||||
lsclient, err := codespaces.ConnectToLiveshare(ctx, log, apiClient, user.Login, token, codespace)
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ func newSSHCmd() *cobra.Command {
|
|||
|
||||
sshCmd := &cobra.Command{
|
||||
Use: "ssh",
|
||||
Short: "SSH into a Codespace",
|
||||
Short: "SSH into a codespace",
|
||||
Args: cobra.NoArgs,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
return ssh(context.Background(), sshProfile, codespaceName, sshServerPort)
|
||||
|
|
@ -29,7 +29,7 @@ func newSSHCmd() *cobra.Command {
|
|||
|
||||
sshCmd.Flags().StringVarP(&sshProfile, "profile", "", "", "The `name` of the SSH profile to use")
|
||||
sshCmd.Flags().IntVarP(&sshServerPort, "server-port", "", 0, "SSH server port number")
|
||||
sshCmd.Flags().StringVarP(&codespaceName, "codespace", "c", "", "The `name` of the Codespace to use")
|
||||
sshCmd.Flags().StringVarP(&codespaceName, "codespace", "c", "", "The `name` of the codespace to use")
|
||||
|
||||
return sshCmd
|
||||
}
|
||||
|
|
@ -53,7 +53,7 @@ func ssh(ctx context.Context, sshProfile, codespaceName string, localSSHServerPo
|
|||
|
||||
codespace, token, err := codespaces.GetOrChooseCodespace(ctx, apiClient, user, codespaceName)
|
||||
if err != nil {
|
||||
return fmt.Errorf("get or choose Codespace: %v", err)
|
||||
return fmt.Errorf("get or choose codespace: %v", err)
|
||||
}
|
||||
|
||||
lsclient, err := codespaces.ConnectToLiveshare(ctx, log, apiClient, user.Login, token, codespace)
|
||||
|
|
|
|||
|
|
@ -13,13 +13,13 @@ import (
|
|||
)
|
||||
|
||||
var (
|
||||
ErrNoCodespaces = errors.New("You have no Codespaces.")
|
||||
ErrNoCodespaces = errors.New("You have no codespaces.")
|
||||
)
|
||||
|
||||
func ChooseCodespace(ctx context.Context, apiClient *api.API, user *api.User) (*api.Codespace, error) {
|
||||
codespaces, err := apiClient.ListCodespaces(ctx, user)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error getting Codespaces: %v", err)
|
||||
return nil, fmt.Errorf("error getting codespaces: %v", err)
|
||||
}
|
||||
|
||||
if len(codespaces) == 0 {
|
||||
|
|
@ -41,7 +41,7 @@ func ChooseCodespace(ctx context.Context, apiClient *api.API, user *api.User) (*
|
|||
{
|
||||
Name: "codespace",
|
||||
Prompt: &survey.Select{
|
||||
Message: "Choose Codespace:",
|
||||
Message: "Choose codespace:",
|
||||
Options: codespacesNames,
|
||||
Default: codespacesNames[0],
|
||||
},
|
||||
|
|
@ -77,9 +77,9 @@ func ConnectToLiveshare(ctx context.Context, log logger, apiClient *api.API, use
|
|||
var startedCodespace bool
|
||||
if codespace.Environment.State != api.CodespaceEnvironmentStateAvailable {
|
||||
startedCodespace = true
|
||||
log.Print("Starting your Codespace...")
|
||||
log.Print("Starting your codespace...")
|
||||
if err := apiClient.StartCodespace(ctx, token, codespace); err != nil {
|
||||
return nil, fmt.Errorf("error starting Codespace: %v", err)
|
||||
return nil, fmt.Errorf("error starting codespace: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -93,12 +93,12 @@ func ConnectToLiveshare(ctx context.Context, log logger, apiClient *api.API, use
|
|||
}
|
||||
|
||||
if retries == 30 {
|
||||
return nil, errors.New("timed out while waiting for the Codespace to start")
|
||||
return nil, errors.New("timed out while waiting for the codespace to start")
|
||||
}
|
||||
|
||||
codespace, err = apiClient.GetCodespace(ctx, token, userLogin, codespace.Name)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error getting Codespace: %v", err)
|
||||
return nil, fmt.Errorf("error getting codespace: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -106,7 +106,7 @@ func ConnectToLiveshare(ctx context.Context, log logger, apiClient *api.API, use
|
|||
fmt.Print("\n")
|
||||
}
|
||||
|
||||
log.Println("Connecting to your Codespace...")
|
||||
log.Println("Connecting to your codespace...")
|
||||
|
||||
lsclient, err := liveshare.NewClient(
|
||||
liveshare.WithConnection(liveshare.Connection{
|
||||
|
|
@ -134,23 +134,23 @@ func GetOrChooseCodespace(ctx context.Context, apiClient *api.API, user *api.Use
|
|||
if err == ErrNoCodespaces {
|
||||
return nil, "", err
|
||||
}
|
||||
return nil, "", fmt.Errorf("choosing Codespace: %v", err)
|
||||
return nil, "", fmt.Errorf("choosing codespace: %v", err)
|
||||
}
|
||||
codespaceName = codespace.Name
|
||||
|
||||
token, err = apiClient.GetCodespaceToken(ctx, user.Login, codespaceName)
|
||||
if err != nil {
|
||||
return nil, "", fmt.Errorf("getting Codespace token: %v", err)
|
||||
return nil, "", fmt.Errorf("getting codespace token: %v", err)
|
||||
}
|
||||
} else {
|
||||
token, err = apiClient.GetCodespaceToken(ctx, user.Login, codespaceName)
|
||||
if err != nil {
|
||||
return nil, "", fmt.Errorf("getting Codespace token for given codespace: %v", err)
|
||||
return nil, "", fmt.Errorf("getting codespace token for given codespace: %v", err)
|
||||
}
|
||||
|
||||
codespace, err = apiClient.GetCodespace(ctx, token, user.Login, codespaceName)
|
||||
if err != nil {
|
||||
return nil, "", fmt.Errorf("getting full Codespace details: %v", err)
|
||||
return nil, "", fmt.Errorf("getting full codespace details: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ type PostCreateState struct {
|
|||
func PollPostCreateStates(ctx context.Context, log logger, apiClient *api.API, user *api.User, codespace *api.Codespace, poller func([]PostCreateState)) error {
|
||||
token, err := apiClient.GetCodespaceToken(ctx, user.Login, codespace.Name)
|
||||
if err != nil {
|
||||
return fmt.Errorf("getting Codespace token: %v", err)
|
||||
return fmt.Errorf("getting codespace token: %v", err)
|
||||
}
|
||||
|
||||
lsclient, err := ConnectToLiveshare(ctx, log, apiClient, user.Login, token, codespace)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue