diff options
author | Andy Grover <agrover@redhat.com> | 2014-12-17 15:58:57 -0800 |
---|---|---|
committer | Andy Grover <agrover@redhat.com> | 2014-12-17 15:58:57 -0800 |
commit | d220bc0e9770aaa4a8d0a4cb215c4aff4b5ab2e9 (patch) | |
tree | 1d6615d62dfa2595bf32e7b541cf709599b5d346 | |
parent | d0c4aa316916e8f3196f35095b5a8efaeeb979d9 (diff) | |
download | targetcli-d220bc0e9770aaa4a8d0a4cb215c4aff4b5ab2e9.tar.gz |
Autocomplete for restoreconfig and clearconfig
Use complete_path from ui_backstore.
Signed-off-by: Andy Grover <agrover@redhat.com>
-rw-r--r-- | targetcli/ui_root.py | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/targetcli/ui_root.py b/targetcli/ui_root.py index 3f77567..f977bc1 100644 --- a/targetcli/ui_root.py +++ b/targetcli/ui_root.py @@ -23,7 +23,7 @@ from configshell_fb import ExecutionError from ui_node import UINode from socket import gethostname from ui_target import UIFabricModule -from ui_backstore import UIBackstores +from ui_backstore import UIBackstores, complete_path import json import shutil import os @@ -109,6 +109,19 @@ class UIRoot(UINode): self.shell.log.info("Configuration restored from %s" % savefile) + def ui_complete_saveconfig(self, parameters, text, current_param): + ''' + Auto-completes the file name + ''' + if current_param != 'savefile': + return [] + completions = complete_path(text, stat.S_ISREG) + if len(completions) == 1 and not completions[0].endswith('/'): + completions = [completions[0] + ' '] + return completions + + ui_complete_restoreconfig = ui_complete_saveconfig + def ui_command_clearconfig(self, confirm=None): ''' Removes entire configuration of backstores and targets |