Skip to content

Commit 260a884

Browse files
committed
devcontainer outdated command CWD as default folder
1 parent 070aa87 commit 260a884

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/spec-node/devContainersSpecCLI.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1107,14 +1107,20 @@ async function readConfiguration({
11071107
function outdatedOptions(y: Argv) {
11081108
return y.options({
11091109
'user-data-folder': { type: 'string', description: 'Host path to a directory that is intended to be persisted and share state between sessions.' },
1110-
'workspace-folder': { type: 'string', required: true, description: 'Workspace folder path. The devcontainer.json will be looked up relative to this path.' },
1110+
'workspace-folder': { type: 'string', description: 'Workspace folder path. The devcontainer.json will be looked up relative to this path. If --workspace-folder is not provided, defaults to the current directory.' },
11111111
'config': { type: 'string', description: 'devcontainer.json path. The default is to use .devcontainer/devcontainer.json or, if that does not exist, .devcontainer.json in the workspace folder.' },
11121112
'output-format': { choices: ['text' as 'text', 'json' as 'json'], default: 'text', description: 'Output format.' },
11131113
'log-level': { choices: ['info' as 'info', 'debug' as 'debug', 'trace' as 'trace'], default: 'info' as 'info', description: 'Log level for the --terminal-log-file. When set to trace, the log level for --log-file will also be set to trace.' },
11141114
'log-format': { choices: ['text' as 'text', 'json' as 'json'], default: 'text' as 'text', description: 'Log format.' },
11151115
'terminal-columns': { type: 'number', implies: ['terminal-rows'], description: 'Number of columns to render the output for. This is required for some of the subprocesses to correctly render their output.' },
11161116
'terminal-rows': { type: 'number', implies: ['terminal-columns'], description: 'Number of rows to render the output for. This is required for some of the subprocesses to correctly render their output.' },
1117-
});
1117+
})
1118+
.check(argv => {
1119+
if (!argv['workspace-folder']) {
1120+
argv['workspace-folder'] = process.cwd();
1121+
}
1122+
return true;
1123+
});
11181124
}
11191125

11201126
type OutdatedArgs = UnpackArgv<ReturnType<typeof outdatedOptions>>;

0 commit comments

Comments
 (0)