Skip to content

Commit

Permalink
feat: jans-cli --no-suggestion for automated testing (#1437)
Browse files Browse the repository at this point in the history
  • Loading branch information
devrimyatar authored May 26, 2022
1 parent ccfb62e commit 187cc07
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions jans-cli/cli/config_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
from types import SimpleNamespace
from urllib.parse import urlencode
from collections import OrderedDict
from prompt_toolkit import prompt, HTML
from prompt_toolkit.completion import WordCompleter

home_dir = Path.home()
config_dir = home_dir.joinpath('.config')
Expand Down Expand Up @@ -132,11 +130,18 @@ def join(self):
parser.add_argument("--patch-add", help="Colon delimited key:value pair for add patch operation. For example loggingLevel:DEBUG")
parser.add_argument("--patch-replace", help="Colon delimited key:value pair for replace patch operation. For example loggingLevel:DEBUG")
parser.add_argument("--patch-remove", help="Key for remove patch operation. For example imgLocation")
parser.add_argument("--no-suggestion", help="Do not use prompt toolkit to display word completer", action='store_true')

# parser.add_argument("-show-data-type", help="Show data type in schema query", action='store_true')
parser.add_argument("--data", help="Path to json data file")
args = parser.parse_args()


if not args.no_suggestion:
from prompt_toolkit import prompt, HTML
from prompt_toolkit.completion import WordCompleter


################## end of arguments #################

test_client = args.use_test_client
Expand Down Expand Up @@ -789,9 +794,13 @@ def get_input(self, values=[], text='Selection', default=None, itype=None,
values = ['_true', '_false']

while True:
#selection = input(' ' * spacing + self.colored_text(text, 20) + ' ')
html_completer = WordCompleter(values)
selection = prompt(HTML(' ' * spacing + text + ' '), completer=html_completer)

if args.no_suggestion:
selection = input(' ' * spacing + self.colored_text(text, 20) + ' ')
else:
html_completer = WordCompleter(values)
selection = prompt(HTML(' ' * spacing + text + ' '), completer=html_completer)

selection = selection.strip()
if selection.startswith('_file '):
fname = selection.split()[1]
Expand Down

0 comments on commit 187cc07

Please sign in to comment.