Skip to content

Commit dfcef57

Browse files
committed
Re-add colified logic
1 parent 42687bf commit dfcef57

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/spack/external/argparse.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@
9494
import sys as _sys
9595
import textwrap as _textwrap
9696

97+
from llnl.util.tty.colify import colified
98+
9799
from gettext import gettext as _
98100

99101
try:
@@ -2295,8 +2297,8 @@ def _get_value(self, action, arg_string):
22952297
def _check_value(self, action, value):
22962298
# converted value must be one of the choices (if specified)
22972299
if action.choices is not None and value not in action.choices:
2298-
tup = value, ', '.join(map(repr, action.choices))
2299-
msg = _('invalid choice: %r (choose from %s)') % tup
2300+
cols = colified(sorted(action.choices), indent=4, tty=True)
2301+
msg = _('invalid choice: %r choose from:\n%s') % (value, cols)
23002302
raise ArgumentError(action, msg)
23012303

23022304
# =======================

0 commit comments

Comments
 (0)