MCPcopy Create free account
hub / github.com/oboard/claude-code-rev / createSortedHelpConfig

Function createSortedHelpConfig

src/main.tsx:896–907  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

894 // Commander supports compareOptions at runtime but @commander-js/extra-typings
895 // doesn't include it in the type definitions, so we use Object.assign to add it.
896 function createSortedHelpConfig(): {
897 sortSubcommands: true;
898 sortOptions: true;
899 } {
900 const getOptionSortKey = (opt: Option): string => opt.long?.replace(/^--/, '') ?? opt.short?.replace(/^-/, '') ?? '';
901 return Object.assign({
902 sortSubcommands: true,
903 sortOptions: true
904 } as const, {
905 compareOptions: (a: Option, b: Option) => getOptionSortKey(a).localeCompare(getOptionSortKey(b))
906 });
907 }
908 const program = new CommanderCommand().configureHelp(createSortedHelpConfig()).enablePositionalOptions();
909 profileCheckpoint('run_commander_initialized');
910

Callers 1

runFunction · 0.85

Calls 1

getOptionSortKeyFunction · 0.85

Tested by

no test coverage detected