comparison tests/test-help.t @ 37091:979c8ce9022d

fancyopts: fix rendering of customopt defaults in help text Differential Revision: https://phab.mercurial-scm.org/D2935
author Daniel Ploch <dploch@google.com>
date Thu, 22 Mar 2018 17:08:25 -0700
parents efc4fb344c05
children 6890b7e991a4
comparison
equal deleted inserted replaced
37090:a61fff493d98 37091:979c8ce9022d
714 (did you mean one of pull, push?) 714 (did you mean one of pull, push?)
715 [255] 715 [255]
716 716
717 $ cat > helpext.py <<EOF 717 $ cat > helpext.py <<EOF
718 > import os 718 > import os
719 > from mercurial import commands, registrar 719 > from mercurial import commands, fancyopts, registrar
720 > 720 >
721 > def func(arg):
722 > return '%sfoo' % arg
723 > class customopt(fancyopts.customopt):
724 > def newstate(self, oldstate, newparam, abort):
725 > return '%sbar' % oldstate
721 > cmdtable = {} 726 > cmdtable = {}
722 > command = registrar.command(cmdtable) 727 > command = registrar.command(cmdtable)
723 > 728 >
724 > @command(b'nohelp', 729 > @command(b'nohelp',
725 > [(b'', b'longdesc', 3, b'x'*90), 730 > [(b'', b'longdesc', 3, b'x'*67),
726 > (b'n', b'', None, b'normal desc'), 731 > (b'n', b'', None, b'normal desc'),
727 > (b'', b'newline', b'', b'line1\nline2')], 732 > (b'', b'newline', b'', b'line1\nline2'),
733 > (b'', b'callableopt', func, b'adds foo'),
734 > (b'', b'customopt', customopt(''), b'adds bar'),
735 > (b'', b'customopt-withdefault', customopt('foo'), b'adds bar')],
728 > b'hg nohelp', 736 > b'hg nohelp',
729 > norepo=True) 737 > norepo=True)
730 > @command(b'debugoptADV', [(b'', b'aopt', None, b'option is (ADVANCED)')]) 738 > @command(b'debugoptADV', [(b'', b'aopt', None, b'option is (ADVANCED)')])
731 > @command(b'debugoptDEP', [(b'', b'dopt', None, b'option is (DEPRECATED)')]) 739 > @command(b'debugoptDEP', [(b'', b'dopt', None, b'option is (DEPRECATED)')])
732 > @command(b'debugoptEXP', [(b'', b'eopt', None, b'option is (EXPERIMENTAL)')]) 740 > @command(b'debugoptEXP', [(b'', b'eopt', None, b'option is (EXPERIMENTAL)')])
784 792
785 (no help text available) 793 (no help text available)
786 794
787 options: 795 options:
788 796
789 --longdesc VALUE xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 797 --longdesc VALUE
790 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx (default: 3) 798 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
791 -n -- normal desc 799 xxxxxxxxxxxxxxxxxxxxxxx (default: 3)
792 --newline VALUE line1 line2 800 -n -- normal desc
801 --newline VALUE line1 line2
802 --callableopt VALUE adds foo
803 --customopt VALUE adds bar
804 --customopt-withdefault VALUE adds bar (default: foo)
793 805
794 (some details hidden, use --verbose to show complete help) 806 (some details hidden, use --verbose to show complete help)
795 807
796 $ hg help -k nohelp 808 $ hg help -k nohelp
797 Commands: 809 Commands: