comparison mercurial/commands.py @ 27377:d1c998d7b103

help: pass subtopic into help() Now that we have multiple directories where help topics can live, we need a mechanism to access them. We already use "." to separate topic from section. So it seems logical to also use "." to denote the sub-directory of a topic. This patch teaches the help command to parse out the possible sub-topic and pass it to the help system.
author Gregory Szorc <gregory.szorc@gmail.com>
date Sun, 13 Dec 2015 11:04:45 -0800
parents 9fd8f1552369
children 20e7de6205e7
comparison
equal deleted inserted replaced
27376:fc810d950278 27377:d1c998d7b103
4365 else: 4365 else:
4366 keep.append('unix') 4366 keep.append('unix')
4367 keep.append(sys.platform.lower()) 4367 keep.append(sys.platform.lower())
4368 4368
4369 section = None 4369 section = None
4370 subtopic = None
4370 if name and '.' in name: 4371 if name and '.' in name:
4371 name, section = name.split('.', 1) 4372 name, section = name.split('.', 1)
4372 section = section.lower() 4373 section = section.lower()
4373 4374 if '.' in section:
4374 text = help.help_(ui, name, **opts) 4375 subtopic, section = section.split('.', 1)
4376 else:
4377 subtopic = section
4378
4379 text = help.help_(ui, name, subtopic=subtopic, **opts)
4375 4380
4376 formatted, pruned = minirst.format(text, textwidth, keep=keep, 4381 formatted, pruned = minirst.format(text, textwidth, keep=keep,
4377 section=section) 4382 section=section)
4378 4383
4379 # We could have been given a weird ".foo" section without a name 4384 # We could have been given a weird ".foo" section without a name