Merge pull request #105 from github/product-spelling
spell product names (Codespace, Live Share) correctly in UI
This commit is contained in:
commit
5238f249f3
11 changed files with 47 additions and 48 deletions
|
|
@ -278,12 +278,11 @@ func (a *API) StartCodespace(ctx context.Context, token string, codespace *Codes
|
|||
if len(b) > 100 {
|
||||
b = append(b[:97], "..."...)
|
||||
}
|
||||
|
||||
if resp.StatusCode == http.StatusServiceUnavailable && strings.TrimSpace(string(b)) == "7" {
|
||||
// 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)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ 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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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, 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, location string, apiClient *api.API) (string, error) {
|
||||
skus, err := apiClient.GetCodespacesSKUs(ctx, user, repo, location)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("error getting codespace SKUs: %v", err)
|
||||
return "", fmt.Errorf("error getting Codespace SKUs: %v", err)
|
||||
}
|
||||
|
||||
// if user supplied a machine type, it must be valid
|
||||
|
|
|
|||
|
|
@ -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{})
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -49,12 +49,12 @@ func logs(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)
|
||||
if err != nil {
|
||||
return fmt.Errorf("connecting to liveshare: %v", err)
|
||||
return fmt.Errorf("connecting to Live Share: %v", err)
|
||||
}
|
||||
|
||||
remoteSSHServerPort, sshUser, err := codespaces.StartSSHServer(ctx, lsclient, log)
|
||||
|
|
|
|||
|
|
@ -71,14 +71,14 @@ 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)
|
||||
|
||||
liveShareClient, err := codespaces.ConnectToLiveshare(ctx, log, apiClient, user.Login, token, codespace)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error connecting to liveshare: %v", err)
|
||||
return fmt.Errorf("error connecting to Live Share: %v", err)
|
||||
}
|
||||
|
||||
log.Println("Loading ports...")
|
||||
|
|
@ -211,17 +211,17 @@ 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)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error connecting to liveshare: %v", err)
|
||||
return fmt.Errorf("error connecting to Live Share: %v", err)
|
||||
}
|
||||
|
||||
server, err := liveshare.NewServer(lsclient)
|
||||
|
|
@ -277,17 +277,17 @@ 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)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error connecting to liveshare: %v", err)
|
||||
return fmt.Errorf("error connecting to Live Share: %v", err)
|
||||
}
|
||||
|
||||
server, err := liveshare.NewServer(lsclient)
|
||||
|
|
|
|||
|
|
@ -50,12 +50,12 @@ func ssh(sshProfile, codespaceName string, sshServerPort int) 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)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error connecting to liveshare: %v", err)
|
||||
return fmt.Errorf("error connecting to Live Share: %v", err)
|
||||
}
|
||||
|
||||
remoteSSHServerPort, sshUser, err := codespaces.StartSSHServer(ctx, lsclient, log)
|
||||
|
|
@ -65,7 +65,7 @@ func ssh(sshProfile, codespaceName string, sshServerPort int) error {
|
|||
|
||||
terminal, err := liveshare.NewTerminal(lsclient)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error creating liveshare terminal: %v", err)
|
||||
return fmt.Errorf("error creating Live Share terminal: %v", err)
|
||||
}
|
||||
|
||||
log.Print("Preparing SSH...")
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
@ -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{
|
||||
|
|
@ -117,11 +117,11 @@ func ConnectToLiveshare(ctx context.Context, log logger, apiClient *api.API, use
|
|||
}),
|
||||
)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error creating live share: %v", err)
|
||||
return nil, fmt.Errorf("error creating Live Share: %v", err)
|
||||
}
|
||||
|
||||
if err := lsclient.Join(ctx); err != nil {
|
||||
return nil, fmt.Errorf("error joining liveshare client: %v", err)
|
||||
return nil, fmt.Errorf("error joining Live Share client: %v", err)
|
||||
}
|
||||
|
||||
return lsclient, nil
|
||||
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ func MakeSSHTunnel(ctx context.Context, lsclient *liveshare.Client, localSSHPort
|
|||
|
||||
server, err := liveshare.NewServer(lsclient)
|
||||
if err != nil {
|
||||
return 0, nil, fmt.Errorf("new liveshare server: %v", err)
|
||||
return 0, nil, fmt.Errorf("new Live Share server: %v", err)
|
||||
}
|
||||
|
||||
rand.Seed(time.Now().Unix())
|
||||
|
|
|
|||
|
|
@ -37,12 +37,12 @@ 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)
|
||||
if err != nil {
|
||||
return fmt.Errorf("connect to liveshare: %v", err)
|
||||
return fmt.Errorf("connect to Live Share: %v", err)
|
||||
}
|
||||
|
||||
remoteSSHServerPort, sshUser, err := StartSSHServer(ctx, lsclient, log)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue