MCPcopy Create free account
hub / github.com/T-Lab-CUHKSZ/claude-code / createSortedHelpConfig

Function createSortedHelpConfig

src/main.tsx:903–914  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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

Callers 1

runFunction · 0.85

Calls 1

getOptionSortKeyFunction · 0.85

Tested by

no test coverage detected