You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can also download the pre-compiled binaries from the [Codesphere CLI Releases page](https://github.com/codesphere-cloud/cs-go/releases).
39
+
40
+
1. Go to the [latest release](https://github.com/codesphere-cloud/cs-go/releases/latest).
41
+
42
+
2. Download the appropriate release for your operating system and architecture (e.g., `cs-go_darwin_amd64` for macOS, `cs-go_linux_amd64` for Linux, or `cs-go_windows_amd64` for Windows).
43
+
44
+
3. Move the `cs` binary to a directory in your system's `PATH` (e.g., `/usr/local/bin` on Linux/Mac, or a directory added to `Path` environment variable on Windows).
45
+
46
+
4. Make the binary executable (e.g. by running `chmod +x /usr/local/bin/cs` on Mac or Linux)
47
+
48
+
### Usage Guide
49
+
50
+
The Codesphere CLI (`cs`) allows you to manage and debug resources deployed in Codesphere directly from your command line.
51
+
52
+
#### Global Options & Environment Variables
53
+
54
+
The `cs` CLI supports several global options that you can set via command-line flags or environment variables. Using environment variables is handy for setting persistent configurations.
| API URL |`--api`, `-a`|`CS_API`| URL of the Codesphere API. |`https://codesphere.com/api`|
59
+
| Team ID |`--team`, `-t`|`CS_TEAM_ID`| Your Codesphere Team ID. This is relevant for commands operating on a specific team. | None (required for some commands) |
60
+
| Workspace ID |`--workspace`, `-w`|`CS_WORKSPACE_ID`| Your Codesphere Workspace ID. Relevant for commands targeting a specific workspace. | None (required for some commands) |
61
+
62
+
**Note on Team ID and Workspace ID:** If you don't provide these via a flag, the CLI will try to get them from the corresponding environment variables (`CS_TEAM_ID`, `CS_WORKSPACE_ID`). If they're still not found and a command requires them, the CLI will return an error.
63
+
64
+
#### Available Commands
65
+
66
+
The `cs` CLI organizes its functionality into several top-level commands, each with specific subcommands and flags.
67
+
68
+
##### `cs list`
69
+
70
+
Use this command to list various resources available in Codesphere.
71
+
72
+
**Usage:**
27
73
28
74
```
29
-
CS_TOKEN - API token, generate in UI
30
-
CS_WORKSPACE_ID - workspace ID to target, get from environment in Web IDE
31
-
CS_API - API url of codesphere, defaults to https://codesphere.com/api
75
+
cs list [command]
76
+
32
77
```
33
78
34
-
## Go SDK
79
+
###### `cs list teams`
80
+
81
+
Lists all teams you have access to in Codesphere.
82
+
83
+
**Usage:**
84
+
85
+
```
86
+
cs list teams
87
+
88
+
```
89
+
90
+
**Example:**
91
+
92
+
```
93
+
$ cs list teams
35
94
95
+
```
96
+
97
+
###### `cs list workspaces`
98
+
99
+
Lists all workspaces available in Codesphere.
100
+
101
+
**Usage:**
102
+
103
+
```
104
+
cs list workspaces [--team-id <team-id>]
105
+
```
106
+
107
+
**Example:**
36
108
109
+
```
110
+
$ cs list workspaces --team-id <team-id>
111
+
```
112
+
113
+
If you don't specify `--team-id`, the command will try to list workspaces for all teams you can access (or for the team specified by `CS_TEAM_ID`).
114
+
115
+
##### `cs log`
116
+
117
+
Retrieves run logs from services within your workspaces.
118
+
119
+
**Usage:**
120
+
121
+
```
122
+
cs log --workspace-id <workspace-id> [options]
123
+
```
124
+
125
+
**Description:**
126
+
127
+
You can retrieve logs based on the given scope. If you provide both the step number and server, it returns all logs from all replicas of that server. If you provide a specific replica ID, it will return logs for that replica only.
128
+
129
+
**Examples:**
130
+
131
+
```
132
+
# Get logs from a specific server within a workspace
*`--server`, `-s` (string): Name of the landscape server.
148
+
149
+
*`--workspace-id`, `-w` (int): ID of your Codesphere workspace. You can also set this via the `CS_WORKSPACE_ID` environment variable. **This flag or environment variable is required if not set globally.**
150
+
151
+
*`--step`, `-n` (int): Index of the execution step (default 0).
152
+
153
+
*`--replica`, `-r` (string): ID of the server replica. If you provide this, the `--server` flag will be ignored.
*`--env-var`, `-e` (stringArray): Environment variables to set, in the format `key=val`. You can use this flag multiple times to set several variables.
179
+
180
+
## Go SDK
37
181
38
182
## Community & Contributions
39
183
40
-
Please review our [Code of Conduct](CODE_OF_CONDUCT.md) to understand our community expectations.
184
+
Please review our [Code of Conduct](CODE_OF_CONDUCT.md) to understand our community expectations.
41
185
We welcome contributions! All contributions to this project must be made in accordance with the Developer Certificate of Origin (DCO). See our full [Contributing Guidelines](CONTRIBUTING.md) for details.
0 commit comments