##// END OF EJS Templates
magic_arguments: dedent but otherwise preserve indentation....
Bradley M. Froehle -
Show More
@@ -50,7 +50,13 b' arguments::'
50 from IPython.external import argparse
50 from IPython.external import argparse
51 from IPython.core.error import UsageError
51 from IPython.core.error import UsageError
52 from IPython.utils.process import arg_split
52 from IPython.utils.process import arg_split
53 from IPython.utils.text import dedent
53
54
55 class MagicHelpFormatter(argparse.RawDescriptionHelpFormatter):
56 """ A HelpFormatter which dedents but otherwise preserves indentation.
57 """
58 def _fill_text(self, text, width, indent):
59 return argparse.RawDescriptionHelpFormatter._fill_text(self, dedent(text), width, indent)
54
60
55 class MagicArgumentParser(argparse.ArgumentParser):
61 class MagicArgumentParser(argparse.ArgumentParser):
56 """ An ArgumentParser tweaked for use by IPython magics.
62 """ An ArgumentParser tweaked for use by IPython magics.
@@ -62,7 +68,7 b' class MagicArgumentParser(argparse.ArgumentParser):'
62 epilog=None,
68 epilog=None,
63 version=None,
69 version=None,
64 parents=None,
70 parents=None,
65 formatter_class=argparse.HelpFormatter,
71 formatter_class=MagicHelpFormatter,
66 prefix_chars='-',
72 prefix_chars='-',
67 argument_default=None,
73 argument_default=None,
68 conflict_handler='error',
74 conflict_handler='error',
General Comments 0
You need to be logged in to leave comments. Login now