Skip to content

Commit

Permalink
feat(command): add autocompletion for types
Browse files Browse the repository at this point in the history
  • Loading branch information
c4spar committed Mar 31, 2020
1 parent a785164 commit 16d5237
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/command/types/boolean.ts
Expand Up @@ -8,4 +8,9 @@ export class BooleanType extends Type<boolean> {

return boolean( option, arg, value );
}

public complete(): string[] {

return [ 'true', 'false' ];
}
}
5 changes: 5 additions & 0 deletions packages/command/types/number.ts
Expand Up @@ -8,4 +8,9 @@ export class NumberType extends Type<number> {

return number( option, arg, value );
}

public complete(): string[] {

return [];
}
}
5 changes: 5 additions & 0 deletions packages/command/types/string.ts
Expand Up @@ -8,4 +8,9 @@ export class StringType extends Type<string> {

return string( option, arg, value );
}

public complete(): string[] {

return [];
}
}
2 changes: 2 additions & 0 deletions packages/command/types/type.ts
Expand Up @@ -3,4 +3,6 @@ import { IFlagArgument, IFlagOptions } from '../../flags/lib/types.ts';
export abstract class Type<T> {

public abstract parse( option: IFlagOptions, arg: IFlagArgument, value: string | false ): T | undefined

public abstract complete(): string[];
}

0 comments on commit 16d5237

Please sign in to comment.