easy-cli-framework
Version:
A framework for building CLI applications that are robust and easy to maintain. Supports theming, configuration files, interactive prompts, and more.
35 lines (27 loc) • 768 B
text/typescript
import {
promptTextInput,
} from 'easy-cli-framework/prompts';
import { EasyCLITheme } from 'easy-cli-framework/themes';
const main = async () => {
const theme = new EasyCLITheme(3);
const text = await promptTextInput('Enter some text');
const text2 = await promptTextInput('Enter a color (red, green or blue)', {
validator: (input: any) => ['red', 'green', 'blue'].includes(input),
validationErrorMessage: 'Invalid color',
});
const password = await promptTextInput('Enter a password', {
type: 'password',
});
const editor = await promptTextInput('Enter some text', {
type: 'editor',
});
console.log({
text,
text2,
password,
editor,
});
};
main()
.catch(console.error)
.finally(() => process.exit(0));