fix: support numeric string
This commit is contained in:
parent
87b24e7367
commit
164f8c5a60
2 changed files with 15 additions and 1 deletions
|
|
@ -1,7 +1,7 @@
|
|||
"""
|
||||
Silique (https://www.silique.fr)
|
||||
Copyright (C) 2024-2025
|
||||
|
||||
|
||||
This program is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU Lesser General Public License as published by the
|
||||
Free Software Foundation, either version 3 of the License, or (at your
|
||||
|
|
@ -119,6 +119,7 @@ class RougailOutputFormatter:
|
|||
self.attributes = {}
|
||||
|
||||
self.yaml = YAML()
|
||||
self.conv_yaml = YAML()
|
||||
|
||||
def run(self):
|
||||
self.upgrade()
|
||||
|
|
@ -391,6 +392,15 @@ class RougailOutputFormatter:
|
|||
else:
|
||||
ret[name] = default
|
||||
add_column += len(str(default)) + 1
|
||||
if isinstance(default, str):
|
||||
# some entries have ' (like '8080') those characters are not count, so add it
|
||||
with BytesIO() as ymlfh:
|
||||
self.conv_yaml.dump(default, ymlfh)
|
||||
ret2 = ymlfh.getvalue().decode("utf-8").strip()
|
||||
if ret2.endswith("..."):
|
||||
ret2 = ret2[:-3].strip()
|
||||
if default != ret2:
|
||||
add_column += len(ret2) - len(default)
|
||||
if "description" in variable:
|
||||
description = variable["description"].strip()
|
||||
if self.remaining and (not multi or not default):
|
||||
|
|
|
|||
|
|
@ -13,4 +13,8 @@ var4: value # the forth variable
|
|||
var5: value # the fifth variable
|
||||
|
||||
var6: value # the sixth variable
|
||||
|
||||
var7: '8080' # the seventh variable
|
||||
|
||||
var8: 'true' # the height variable
|
||||
...
|
||||
|
|
|
|||
Loading…
Reference in a new issue