1.0.0 • Published 3 years ago

ts-cli-flags v1.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

Flags

A CLI flags parser inspired by golang's flag module.

Usage:

import flags from 'ts-cli-flags';

const mature = flags.boolean('mature', false, 'Describes if the person is of mature age');
const name = flags.string('name', 'John', "Person's name");
const age = flags.number('age', 0, "Preson's age");
const birthday = flags.date('birthday', new Date(0), "Person's birhday");

try {
  flags.parse();
} catch (e) {
  console.log('USAGE:');
  flags.printDefaults();
}

console.log({
  mature: mature.value,
  name: name.value,
  surname: surname.value,
  age: age.value,
  birthday: birthday.value,
});

Inspiration: