fix: fix float opt min and max value format errror

"%d" will truncate float and generates wrong format message,
use "format" to handle floats correctly.

Closes-Bug: 1850879
Change-Id: If0dd3933695ac84f0e9cacefd28a9d7a60dd88d7
This commit is contained in:
huang.xiangdong 2019-11-01 11:18:21 +08:00
parent 0f7244f9dc
commit 561db7ac32

View File

@ -255,10 +255,10 @@ class _OptFormatter(object):
lines = self._format_help(help_text)
if getattr(opt.type, 'min', None) is not None:
lines.append('# Minimum value: %d\n' % opt.type.min)
lines.append('# Minimum value: {}\n'.format(opt.type.min))
if getattr(opt.type, 'max', None) is not None:
lines.append('# Maximum value: %d\n' % opt.type.max)
lines.append('# Maximum value: {}\n'.format(opt.type.max))
if getattr(opt.type, 'choices', None):
lines.append('# Possible values:\n')