summaryrefslogtreecommitdiff
path: root/scripts/build-command-op-templates
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2022-07-30 15:21:36 +0200
committerChristian Poessinger <christian@poessinger.com>2022-07-30 15:21:36 +0200
commit11a605d303bce5384a64ad887566c064eb4f206a (patch)
tree6d61046091f334be0132ab4cd14846121946f085 /scripts/build-command-op-templates
parent2f2e8125560a19b51e0034ec88cf69ce1fd1afb5 (diff)
downloadvyos-1x-11a605d303bce5384a64ad887566c064eb4f206a.tar.gz
vyos-1x-11a605d303bce5384a64ad887566c064eb4f206a.zip
op-mode: T1748: vbash: beautify tab completion output/line breaks
Diffstat (limited to 'scripts/build-command-op-templates')
-rwxr-xr-xscripts/build-command-op-templates11
1 files changed, 7 insertions, 4 deletions
diff --git a/scripts/build-command-op-templates b/scripts/build-command-op-templates
index d4515b8db..b008596dc 100755
--- a/scripts/build-command-op-templates
+++ b/scripts/build-command-op-templates
@@ -27,6 +27,7 @@ import copy
import functools
from lxml import etree as ET
+from textwrap import fill
# Defaults
validator_dir = "/opt/vyatta/libexec/validators"
@@ -123,13 +124,15 @@ def make_node_def(props, command):
node_def = ""
if "help" in props:
- node_def += "help: {0}\n".format(props["help"])
+ help = props["help"]
+ help = fill(help, width=64, subsequent_indent='\t\t\t')
+ node_def += f'help: {help}\n'
if "comp_help" in props:
- node_def += "allowed: {0}\n".format(props["comp_help"])
+ node_def += f'allowed: {props["comp_help"]}\n'
if command is not None:
- node_def += "run: {0}\n".format(command.text)
+ node_def += f'run: {command.text}\n'
if debug:
- print("The contents of the node.def file:\n", node_def)
+ print('Contents of the node.def file:\n', node_def)
return node_def