Make the CommandDefinition option parameter a Partial

This ensures that no code accidentally relies on them being present, and
the types are then correct.

Change-type: patch
Signed-off-by: Cameron Diver <cameron@balena.io>
This commit is contained in:
Cameron Diver 2019-05-28 17:31:18 +01:00 committed by Paulo Castro
parent b391c96e64
commit 5da307f02e
3 changed files with 6 additions and 3 deletions

View File

@ -29,6 +29,9 @@ function renderCapitanoCommand(command: CapitanoCommand): string[] {
result.push('### Options');
for (const option of command.options!) {
if (option == null) {
throw new Error(`Undefined option in markdown generation!`);
}
result.push(
`#### ${utils.parseCapitanoOption(option)}`,
option.description,

View File

@ -138,7 +138,7 @@ export const remove: CommandDefinition<
return patterns
.confirm(
options.yes,
options.yes || false,
'Are you sure you want to delete the environment variable?',
)
.then(function() {

View File

@ -36,11 +36,11 @@ declare module 'capitano' {
signature: string;
description: string;
help: string;
options?: OptionDefinition[];
options?: Partial<OptionDefinition[]>;
permission?: 'user';
root?: boolean;
primary?: boolean;
action(params: P, options: O, done: () => void): void;
action(params: P, options: Partial<O>, done: () => void): void;
}
export interface Command {