diff --git a/mercurial_keyring.py b/mercurial_keyring.py --- a/mercurial_keyring.py +++ b/mercurial_keyring.py @@ -702,11 +702,15 @@ command = meu.command(cmdtable) @command('keyring_check', [], - _("keyring_check [PATH]")) + _("keyring_check [PATH]"), + optionalrepo=True) def cmd_keyring_check(ui, repo, *path_args, **opts): # pylint: disable=unused-argument """ Prints basic info (whether password is currently saved, and how is - it identified) for given path or for all defined repo paths which are HTTP. + it identified) for given path. + + Can be run without parameters to show status for all (current repository) paths which + are HTTP-like. """ defined_paths = [(name, url) for name, url in ui.configitems('paths')] @@ -716,10 +720,14 @@ def cmd_keyring_check(ui, repo, *path_ar paths = [(path_arg, defined_paths_dic.get(path_arg, path_arg)) for path_arg in path_args] else: + if not repo: + ui.status(_("Url to check not specified. Either run ``hg keyring_check https://...``, or run the command inside some repository (to test all defined paths).\n")) + return paths = [(name, url) for name, url in defined_paths] if not paths: ui.status(_("keyring_check: no paths defined\n")) + return handler = HTTPPasswordHandler() @@ -744,10 +752,14 @@ def cmd_keyring_check(ui, repo, *path_ar @command('keyring_clear', [], - _('hg keyring_clear PATH')) + _('hg keyring_clear PATH-OR-ALIAS'), + optionalrepo=True) def cmd_keyring_clear(ui, repo, path, **opts): # pylint: disable=unused-argument """ Drops password bound to given path (if any is saved). + + Parameter can be given as full url (``https://John@bitbucket.org``) or as the name + of path alias (``bitbucket``). """ path_url = path for name, url in ui.configitems('paths'): @@ -755,7 +767,7 @@ def cmd_keyring_clear(ui, repo, path, ** path_url = url break if not is_http_path(path_url): - ui.warn(_("%s is not a http path (%s)") % (path, path_url)) + ui.status(_("%s is not a http path (and %s can't be resolved as path alias)\n") % (path, path_url)) return handler = HTTPPasswordHandler()