forked from coder/vscode-coder
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcliConfig.ts
More file actions
29 lines (26 loc) · 904 Bytes
/
Copy pathcliConfig.ts
File metadata and controls
29 lines (26 loc) · 904 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import { type WorkspaceConfiguration } from "vscode";
import { getHeaderArgs } from "./headers";
import { escapeCommandArg } from "./util";
/**
* Returns global configuration flags for Coder CLI commands.
* Always includes the `--global-config` argument with the specified config directory.
*/
export function getGlobalFlags(
configs: WorkspaceConfiguration,
configDir: string,
): string[] {
// Last takes precedence/overrides previous ones
return [
...(configs.get<string[]>("coder.globalFlags") || []),
"--global-config",
escapeCommandArg(configDir),
...getHeaderArgs(configs),
];
}
/**
* Returns SSH flags for the `coder ssh` command from user configuration.
*/
export function getSshFlags(configs: WorkspaceConfiguration): string[] {
// Make sure to match this default with the one in the package.json
return configs.get<string[]>("coder.sshFlags", ["--disable-autostart"]);
}