Archived
1
0

Accept argument to change initial working directory

This commit is contained in:
Asher 2019-07-12 18:41:56 -05:00
parent e22791ec88
commit 8dcc1e3567
No known key found for this signature in database
GPG Key ID: D63C1EF81242354A
3 changed files with 46 additions and 26 deletions

View File

@ -5,7 +5,8 @@
[![MIT license](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/cdr/code-server/blob/master/LICENSE)
[![Discord](https://img.shields.io/discord/463752820026376202.svg?label=&logo=discord&logoColor=ffffff&color=7389D8&labelColor=6A7EC2)](https://discord.gg/zxSwN8Z)
`code-server` is [VS Code](https://github.com/Microsoft/vscode) running on a remote server, accessible through the browser.
`code-server` is [VS Code](https://github.com/Microsoft/vscode) running on a
remote server, accessible through the browser.
Try it out:
```bash
@ -29,28 +30,35 @@ Use [sshcode](https://github.com/codercom/sshcode) for a simple setup.
### Docker
See docker oneliner mentioned above. Dockerfile is at [/Dockerfile](/Dockerfile).
See docker oneliner mentioned above. Dockerfile is at
[/Dockerfile](/Dockerfile).
### Binaries
1. [Download a binary](https://github.com/cdr/code-server/releases) (Linux and OS X supported. Windows coming soon)
1. [Download a binary](https://github.com/cdr/code-server/releases) (Linux and
OS X supported. Windows coming soon)
2. Start the binary with the project directory as the first argument
```
code-server <initial directory to open>
```
> You will be prompted to enter the password shown in the CLI
`code-server` should now be running at https://localhost:8443.
```
code-server <initial directory to open>
```
You will be prompted to enter the password shown in the CLI. `code-server`
should now be running at https://localhost:8443.
> code-server uses a self-signed SSL certificate that may prompt your browser to ask you some additional questions before you proceed. Please [read here](doc/self-hosted/index.md) for more information.
`code-server` uses a self-signed SSL certificate that may prompt your
browser to ask you some additional questions before you proceed. Please
[read here](doc/self-hosted/index.md) for more information.
For detailed instructions and troubleshooting, see the [self-hosted quick start guide](doc/self-hosted/index.md).
For detailed instructions and troubleshooting, see the
[self-hosted quick start guide](doc/self-hosted/index.md).
Quickstart guides for [Google Cloud](doc/admin/install/google_cloud.md), [AWS](doc/admin/install/aws.md), and [DigitalOcean](doc/admin/install/digitalocean.md).
Quickstart guides for [Google Cloud](doc/admin/install/google_cloud.md),
[AWS](doc/admin/install/aws.md), and
[DigitalOcean](doc/admin/install/digitalocean.md).
How to [secure your setup](/doc/security/ssl.md).
## Build
### Build
- If you also plan on developing, set the `OUT` environment variable: `
export OUT=/path/to/some/directory`. Otherwise it will build in this
directory which will cause issues because then `yarn watch` will try to
@ -62,7 +70,7 @@ How to [secure your setup](/doc/security/ssl.md).
`yarn binary` with the same arguments in the previous step to package the
code into a single binary.
## Development
### Development
```fish
git clone https://github.com/microsoft/vscode
@ -77,25 +85,31 @@ yarn start --allow-http --no-auth
# Visit http://localhost:8443
```
### Known Issues
## Known Issues
- Creating custom VS Code extensions and debugging them doesn't work.
- To debug Golang using [ms-vscode-go extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode.Go), you need to add `--security-opt seccomp=unconfined` to your `docker run` arguments when launching code-server with Docker. See [#725](https://github.com/cdr/code-server/issues/725) for details.
- To debug Golang using
[ms-vscode-go extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode.Go),
you need to add `--security-opt seccomp=unconfined` to your `docker run`
arguments when launching code-server with Docker. See
[#725](https://github.com/cdr/code-server/issues/725) for details.
### Future
## Future
- **Stay up to date!** Get notified about new releases of code-server.
![Screenshot](/doc/assets/release.gif)
- Windows support.
- Electron and Chrome OS applications to bridge the gap between local<->remote.
- Run VS Code unit tests against our builds to ensure features work as expected.
### Extensions
## Extensions
At the moment we can't use the official VSCode Marketplace. We've created a custom extension marketplace focused around open-sourced extensions. However, if you have access to the `.vsix` file, you can manually install the extension.
At the moment we can't use the official VSCode Marketplace. We've created a
custom extension marketplace focused around open-sourced extensions. However,
if you have access to the `.vsix` file, you can manually install the extension.
## Telemetry
Use the `--disable-telemetry` flag or set `DISABLE_TELEMETRY=true` to disable tracking ENTIRELY.
Set the `telemetry.enableTelemetry` user setting to false to disable telemetry.
We use data collected to improve code-server.
@ -109,8 +123,10 @@ Development guides are coming soon.
## Enterprise
Visit [our enterprise page](https://coder.com/enterprise) for more information about our enterprise offering.
Visit [our enterprise page](https://coder.com/enterprise) for more information
about our enterprise offering.
## Commercialization
If you would like to commercialize code-server, please contact contact@coder.com.
If you would like to commercialize code-server, please contact
contact@coder.com.

View File

@ -127,6 +127,9 @@ const main = async (): Promise<void> => {
certKey: args["cert-key"],
auth: typeof args.auth !== "undefined" ? args.auth : true,
password: process.env.PASSWORD,
folderUri: args["_"] && args["_"].length > 1
? args["_"][args["_"].length - 1]
: undefined,
};
if (!options.host) {

View File

@ -97,6 +97,7 @@ export interface ServerOptions {
readonly certKey?: string;
readonly auth?: boolean;
readonly password?: string;
readonly folderUri?: string;
}
export abstract class Server {
@ -107,7 +108,7 @@ export abstract class Server {
private listenPromise: Promise<string> | undefined;
public constructor(private readonly options: ServerOptions) {
public constructor(protected readonly options: ServerOptions) {
if (this.options.cert && this.options.certKey) {
useHttpsTransformer();
const httpolyglot = require.__$__nodeRequire(path.resolve(__dirname, "../node_modules/httpolyglot/lib/index")) as typeof import("httpolyglot");
@ -458,7 +459,7 @@ export class MainServer extends Server {
const cwd = process.env.VSCODE_CWD || process.cwd();
const workspacePath = parsedUrl.query.workspace as string | undefined;
const folderPath = !workspacePath ? parsedUrl.query.folder as string | undefined || cwd: undefined;
const folderPath = !workspacePath ? parsedUrl.query.folder as string | undefined || this.options.folderUri || cwd: undefined;
const options: Options = {
WORKBENCH_WEB_CONGIGURATION: {