217
218
def add_string(proto, help, maxl, prefix_width=20):
218
help_lines = textwrap.wrap(help, maxl - prefix_width,
219
break_long_words=False)
220
line_with_indent = '\n' + ' ' * prefix_width
221
help_text = line_with_indent.join(help_lines)
222
return "%-20s%s\n" % (proto, help_text)
219
help_lines = textwrap.wrap(help, maxl - prefix_width,
220
break_long_words=False)
221
line_with_indent = '\n' + ' ' * prefix_width
222
help_text = line_with_indent.join(help_lines)
223
return "%-20s%s\n" % (proto, help_text)
225
226
return a[:a.rfind("://")]
607
607
("BRZ_CONCURRENCY", "Number of processes that can be run concurrently (selftest)"),
608
608
("BRZ_PROGRESS_BAR", "Override the progress display. Values are 'none' or 'text'."),
609
609
("BRZ_PDB", "Control whether to launch a debugger on error."),
610
("BRZ_SIGQUIT_PDB", "Control whether SIGQUIT behaves normally or invokes a breakin debugger."),
611
("BRZ_TEXTUI_INPUT", "Force console input mode for prompts to line-based (instead of char-based)."),
611
"Control whether SIGQUIT behaves normally or invokes a breakin debugger."),
613
"Force console input mode for prompts to line-based (instead of char-based)."),
614
617
def _env_variables(topic):
616
619
ret = ["Environment Variables\n\n"
617
"See brz help configuration for more details.\n\n"]
620
"See brz help configuration for more details.\n\n"]
618
621
max_key_len = max([len(k[0]) for k in known_env_variables])
619
622
desc_len = (80 - max_key_len - 2)
620
623
ret.append("=" * max_key_len + " " + "=" * desc_len + "\n")
736
740
"Explain how to use --revision")
737
741
topic_registry.register('basic', _basic_help, "Basic commands", SECT_HIDDEN)
738
742
topic_registry.register('topics', _help_on_topics, "Topics list", SECT_HIDDEN)
739
745
def get_current_formats_topic(topic):
740
746
from breezy import controldir
741
747
return "Current Storage Formats\n\n" + \
742
748
controldir.format_registry.help_topic(topic)
743
751
def get_other_formats_topic(topic):
744
752
from breezy import controldir
745
753
return "Other Storage Formats\n\n" + \
746
754
controldir.format_registry.help_topic(topic)
747
757
topic_registry.register('current-formats', get_current_formats_topic,
748
'Current storage formats')
758
'Current storage formats')
749
759
topic_registry.register('other-formats', get_other_formats_topic,
750
'Experimental and deprecated storage formats')
760
'Experimental and deprecated storage formats')
751
761
topic_registry.register('standard-options', _standard_options,
752
762
'Options that can be used with any command')
753
763
topic_registry.register('global-options', _global_options,
754
'Options that control how Breezy runs')
764
'Options that control how Breezy runs')
755
765
topic_registry.register('urlspec', _help_on_transport,
756
766
"Supported transport protocols")
757
767
topic_registry.register('status-flags', _status_flags,
758
768
"Help on status flags")
759
771
def get_bugs_topic(topic):
760
772
from breezy import bugtracker
761
return ("Bug Tracker Settings\n\n" +
762
bugtracker.tracker_registry.help_topic(topic))
773
return ("Bug Tracker Settings\n\n"
774
+ bugtracker.tracker_registry.help_topic(topic))
763
777
topic_registry.register('bugs', get_bugs_topic, 'Bug tracker settings')
764
778
topic_registry.register('env-variables', _env_variables,
765
779
'Environment variable names and values')
766
780
topic_registry.register('files', _files,
767
781
'Information on configuration and log files')
768
782
topic_registry.register_lazy('hooks', 'breezy.hooks', 'hooks_help_text',
769
'Points at which custom processing can be added')
783
'Points at which custom processing can be added')
770
784
topic_registry.register_lazy('location-alias', 'breezy.directory_service',
771
'AliasDirectory.help_text',
772
'Aliases for remembered locations')
785
'AliasDirectory.help_text',
786
'Aliases for remembered locations')
774
788
# Load some of the help topics from files. Note that topics which reproduce API
775
789
# details will tend to skew (quickly usually!) so please seek other solutions