Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLI improvements #1437

Merged
merged 13 commits into from
Mar 7, 2024
2 changes: 2 additions & 0 deletions packages/cli/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ export const run = () => {
program.option(cmd, param.description);
});

program.allowUnknownOption(true); // integration options are not known ahead of time

// Make both arguments optional un order to allow `$ rnv` top level command
program.arguments('[cmd] [option]').action((cmd, option) => {
cmdValue = cmd;
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/tasks/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ type ParamKeysType = typeof RnvTaskOptions;

type ProgramOptionsKey = keyof ParamKeysType;

//TODO: make this properly typed
//TODO: make this properly typed. Pass integration type to getContext?
type ParamType = any; //boolean | string | undefined

export type ParamKeys = Partial<Record<ProgramOptionsKey, ParamType>>;
Expand Down
3 changes: 2 additions & 1 deletion packages/core/src/tasks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const _getTaskOption = ({ taskInstance }: TaskObj, provider?: string): TaskPromp
output.name = taskInstance.task;
}
output.command = asArray[0];
output.subCommand = asArray[1];
output.subCommand = asArray[1]; // TODO don't treat options like --myopt as subcommands

if (provider) {
output.providers.push(provider);
Expand Down Expand Up @@ -113,6 +113,7 @@ export const getAllSuitableTasks = (c: RnvContext): Record<string, TaskPromptOpt
const taskObj = _getTaskOption(_getTaskObj(taskInstance), 'custom');
suitableTasks[taskObj.value] = taskObj;
});
// TODO: handle integration cli options

return suitableTasks;
};
Expand Down