global flag, choose codespace when empty

This commit is contained in:
Jose Garcia 2021-09-09 11:06:18 -04:00
parent 3a4088a31c
commit 230bf640c5
2 changed files with 38 additions and 28 deletions

View file

@ -124,6 +124,8 @@ func ConnectToLiveshare(ctx context.Context, log logger, apiClient *api.API, use
return lsclient.JoinWorkspace(ctx)
}
// GetOrChooseCodespace prompts the user to choose a codespace if the codespaceName is empty.
// It then fetches the codespace token and the codespace record.
func GetOrChooseCodespace(ctx context.Context, apiClient *api.API, user *api.User, codespaceName string) (codespace *api.Codespace, token string, err error) {
if codespaceName == "" {
codespace, err = ChooseCodespace(ctx, apiClient, user)