vadimdemedes / pastel

🎨 Next.js-like framework for CLIs made with Ink
https://term.ink/pastel
MIT License
2.2k stars 36 forks source link

multiple commands: descriptions not added to help output #40

Closed elricb closed 2 years ago

elricb commented 4 years ago

When using multiple commands their description isn't added to the --help output. It would be nice if each command's description was added beside the command.

Sample Help Output 1

multiple commands

commands/
  commands/test1.js
  commands/test2.js

test1.js

import React from "react";
import PropTypes from "prop-types";
import { Text } from "ink";

/// test1 description
const HelloWorld = () => <Text>Hello World</Text>;

HelloWorld.propTypes = {
  /// prop1 description
  prop1: PropTypes.string
};

export default HelloWorld;

test2.js

import React from "react";
import PropTypes from "prop-types";
import { Text } from "ink";

/// test2 description
const HelloWorld = () => <Text>Hello World</Text>;

HelloWorld.propTypes = {
  /// prop1 description
  prop1: PropTypes.string
};

export default HelloWorld;

help output

cli.js

Commands:
  cli.js test1
  cli.js test2

Options:
  --help     Show help                                                 [boolean]
  --version  Show version number                                       [boolean]

Sample Help Output 2

multiple commands - with index

commands/
  commands/index.js
  commands/test1.js
  commands/test2.js

help output

cli.js

Commands:
  cli.js
  cli.js test1
  cli.js test2
  cli.js        index description                                      [default]

Options:
  --help     Show help                                                 [boolean]
  --version  Show version number                                       [boolean]