26 lines
457 B
TypeScript
26 lines
457 B
TypeScript
|
import { Prompt } from 'enquirer';
|
||
|
|
||
|
export class PathPrompt extends Prompt {
|
||
|
private _index = 0;
|
||
|
private _value = '';
|
||
|
|
||
|
public constructor (options:Record<string, unknown> = {}) {
|
||
|
super (options);
|
||
|
}
|
||
|
|
||
|
public up (): void {
|
||
|
this._index--;
|
||
|
this.render ();
|
||
|
}
|
||
|
|
||
|
public down (): void {
|
||
|
this._index++;
|
||
|
this.render ();
|
||
|
}
|
||
|
|
||
|
public render (): void {
|
||
|
this.clear ();
|
||
|
this.write (`${this.state.message}: ${this._value}`);
|
||
|
}
|
||
|
}
|