Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,18 @@ This project is licensed under the Apache License, Version 2.0 - see the [LICENS

You can install the Codesphere CLI in a few ways:

#### Install inside a Codesphere Workspace

To use the CLI inside a Codesphere workspace, install it using the following command:

```
wget -qO- 'https://api.github.com/repos/codesphere-cloud/cs-go/releases/latest' | grep linux_amd64 | grep browser_download_url | sed s/.*https/https/ | sed s/\".*$// | xargs wget -O $HOME/.local/bin/cs && chmod +x $HOME/.local/bin/cs
```

#### Using GitHub CLI (`gh`)

If you have the [GitHub CLI](https://cli.github.com/) installed, you can install the `cs` CLI with a command like the following.
Not that some commands may require you to elevate to the root user with `sudo`.
Note that some commands may require you to elevate to the root user with `sudo`.

##### ARM Mac

Expand All @@ -38,7 +46,7 @@ chmod +x /usr/local/bin/cs
#### Using `wget`

This option requires to have the `wget` and `jq` utils installed. Download the `cs` CLI and add permissions to run it with the following commands:
Not that some commands may require you to elevate to the root user with `sudo`.
Note that some commands may require you to elevate to the root user with `sudo`.

##### ARM Mac

Expand All @@ -59,7 +67,7 @@ chmod +x /usr/local/bin/cs
#### Manual Download

You can also download the pre-compiled binaries from the [Codesphere CLI Releases page](https://github.com/codesphere-cloud/cs-go/releases).
Not that some commands may require you to elevate to the root user with `sudo`.
Note that some commands may require you to elevate to the root user with `sudo`.

1. Go to the [latest release](https://github.com/codesphere-cloud/cs-go/releases/latest).

Expand Down
4 changes: 2 additions & 2 deletions cli/cmd/set-env-vars.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ func AddSetEnvVarCmd(p *cobra.Command, opts GlobalOptions) {
Short: "set env vars",
Long: `set environment variables for your workspace`,
Example: out.FormatExampleCommands("set-env", []out.Example{
{Cmd: "--workspace-id <workspace-id> --env foo=bar", Desc: "Set single environment variable"},
{Cmd: "--workspace-id <workspace-id> --env foo=bar --env hello=world", Desc: "Set multiple environment variables"},
{Cmd: "--workspace <workspace-id> --env-var foo=bar", Desc: "Set single environment variable"},
{Cmd: "--workspace <workspace-id> --env-var foo=bar --env-var hello=world", Desc: "Set multiple environment variables"},
}),
},
Opts: SetEnvVarOptions{GlobalOptions: opts},
Expand Down
7 changes: 6 additions & 1 deletion pkg/cs/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@ func (e *Environment) GetApiToken() (string, error) {
}

func (e *Environment) GetWorkspaceId() (int, error) {
return e.ReadNumericEnv("CS_WORKSPACE_ID")
prefixedId, err := e.ReadNumericEnv("CS_WORKSPACE_ID")
if prefixedId != -1 && err == nil {
return prefixedId, nil
}

return e.ReadNumericEnv("WORKSPACE_ID")
}

func (e *Environment) GetTeamId() (int, error) {
Expand Down