ai-functions
Version:
A powerful TypeScript library for building AI-powered applications with template literals and structured outputs
38 lines (37 loc) • 850 B
JavaScript
import { version } from '../../package.json';
export function parseArgs(args) {
const options = {};
for (const arg of args) {
if (arg === '-v' || arg === '--version') {
options.version = true;
}
else if (arg === '-h' || arg === '--help') {
options.help = true;
}
}
return options;
}
export function showHelp() {
console.log(`
Usage: ai-functions [options]
Options:
-v, --version Show version number
-h, --help Show help
`);
}
export function showVersion() {
console.log(`v${version}`);
}
export function cli(args = process.argv.slice(2)) {
const options = parseArgs(args);
if (options.version) {
showVersion();
}
else if (options.help) {
showHelp();
}
else {
showHelp();
}
}
//# sourceMappingURL=index.js.map