optionDefinitions.js 979 B

12345678910111213141516171819202122232425262728293031323334353637
  1. import {readFileSync} from 'fs';
  2. const pkg = JSON.parse(readFileSync(
  3. new URL('../package.json', import.meta.url)
  4. ));
  5. /* eslint-disable jsdoc/require-property -- Schema is already below */
  6. /**
  7. * @typedef {PlainObject} CoveradgeOptions
  8. */
  9. /* eslint-enable jsdoc/require-property -- Schema is already below */
  10. const optionDefinitions = [
  11. {
  12. name: 'date', alias: 'd', type: String, defaultOption: true,
  13. description: 'Gregorian date (parseable by `Date`) to convert to ' +
  14. 'Badí\' date (or empty to get today\'s date).',
  15. typeLabel: '{underline date}'
  16. },
  17. {
  18. name: 'verbose', type: Boolean,
  19. description: 'Whether to provide an entire JSON object with full details.'
  20. }
  21. ];
  22. const cliSections = [
  23. {
  24. // Add italics: `{italic textToItalicize}`
  25. content: pkg.description +
  26. '\n\n{italic bahai-date [--verbose] [aDate]}'
  27. },
  28. {
  29. optionList: optionDefinitions
  30. }
  31. ];
  32. export {optionDefinitions as definitions, cliSections as sections};