Skip to content

Commit b3821cb

Browse files
committed
template apply
1 parent 633f21a commit b3821cb

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/spec-node/templatesCLI/apply.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@ import * as jsonc from 'jsonc-parser';
66
import { UnpackArgv } from '../devContainersSpecCLI';
77
import { fetchTemplate, SelectedTemplate, TemplateFeatureOption, TemplateOptions } from '../../spec-configuration/containerTemplatesOCI';
88
import { runAsyncHandler } from '../utils';
9+
import path from 'path';
910

1011
export function templateApplyOptions(y: Argv) {
1112
return y
1213
.options({
13-
'workspace-folder': { type: 'string', alias: 'w', demandOption: true, default: '.', description: 'Target workspace folder to apply Template' },
14+
'workspace-folder': { type: 'string', alias: 'w', default: '.', description: 'Target workspace folder to apply Template' },
1415
'template-id': { type: 'string', alias: 't', demandOption: true, description: 'Reference to a Template in a supported OCI registry' },
1516
'template-args': { type: 'string', alias: 'a', default: '{}', description: 'Arguments to replace within the provided Template, provided as JSON' },
1617
'features': { type: 'string', alias: 'f', default: '[]', description: 'Features to add to the provided Template, provided as JSON.' },
@@ -30,7 +31,7 @@ export function templateApplyHandler(args: TemplateApplyArgs) {
3031
}
3132

3233
async function templateApply({
33-
'workspace-folder': workspaceFolder,
34+
'workspace-folder': workspaceFolderArg,
3435
'template-id': templateId,
3536
'template-args': templateArgs,
3637
'features': featuresArgs,
@@ -42,6 +43,7 @@ async function templateApply({
4243
const dispose = async () => {
4344
await Promise.all(disposables.map(d => d()));
4445
};
46+
const workspaceFolder = workspaceFolderArg ? path.resolve(process.cwd(), workspaceFolderArg) : process.cwd();
4547

4648
const pkg = getPackageConfig();
4749

0 commit comments

Comments
 (0)