Open cspotcode opened 3 years ago
Thinking out loud, the orderCategories
option feels more obvious and straightforward. The array can be declared once, then imported anywhere it is needed.
export const categoryGeneral = 'Options';
export const categoryAdvanced = 'Advanced';
export const categories = [ categoryGeneral, categoryAdvanced ];
import {Categories} from './core';
class Foo extends Command {
static usage: Usage = {
categories // name it "categories" instead of "orderCategories" to be terser?
}
}
When you have an "Advanced" command category, you often want that category to appear last in
--help
. However, it will be alphabetized first.It would be nice to offer a way to explicitly order command categories and, when #35 is implemented, option categories.
For command categories, perhaps
cli.orderCategories([array of category names])
is sufficient.For option categories, we could accept a similar array on the
Usage
object, or we could accept an optionnew Cli({alphabetizeOptions: false})
and document categories in the order they are declared on a command, similar to how positionals are ordered based on declaration order.