MCPcopy
hub / github.com/codeaashu/claude-code / createSortedHelpConfig

Function createSortedHelpConfig

src/main.tsx:890–901  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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

Callers 1

runFunction · 0.85

Calls 1

getOptionSortKeyFunction · 0.85

Tested by

no test coverage detected