console-app/lib/Sources/Interactive/PathSubSource.ts

25 lines
632 B
TypeScript
Raw Normal View History

2020-06-16 12:52:41 +02:00
import { InteractiveSubSource } from './InteractiveSubSource';
import { PathPrompt } from './PathCustomPrompt';
export class PathSubSource extends InteractiveSubSource {
protected condition ():boolean {
return [
'path',
'file',
'folder'
].includes (this.val.type_validation.option_type);
}
protected async run (): Promise<void> {
await this.val.assign_arg (
this.opt,
await new PathPrompt ({
message: this.get_message (),
default: this.opt.default,
folder_only: this.val.type_validation.option_type === 'folder'
2020-06-16 12:52:41 +02:00
})
.run ()
);
}
}