MCPcopy Create free account
hub / github.com/Noumena-Network/code / createSortedHelpConfig

Function createSortedHelpConfig

src/main.tsx:952–963  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

950 // Commander supports compareOptions at runtime but @commander-js/extra-typings
951 // doesn't include it in the type definitions, so we use Object.assign to add it.
952 function createSortedHelpConfig(): {
953 sortSubcommands: true;
954 sortOptions: true;
955 } {
956 const getOptionSortKey = (opt: Option): string => opt.long?.replace(/^--/, '') ?? opt.short?.replace(/^-/, '') ?? '';
957 return Object.assign({
958 sortSubcommands: true,
959 sortOptions: true
960 } as const, {
961 compareOptions: (a: Option, b: Option) => getOptionSortKey(a).localeCompare(getOptionSortKey(b))
962 });
963 }
964 const program = new CommanderCommand().configureHelp(createSortedHelpConfig()).enablePositionalOptions();
965 profileCheckpoint('run_commander_initialized');
966

Callers 1

runFunction · 0.85

Calls 1

getOptionSortKeyFunction · 0.85

Tested by

no test coverage detected