From dd9470af94afffd177fe19375d756af2d854a1ce Mon Sep 17 00:00:00 2001 From: Ryan Roden-Corrent Date: Mon, 1 Aug 2016 12:11:26 -0400 Subject: [PATCH] Show hidden commands in help completion. Hidden commands are not shown in command completion as they typically would not be run directly. However, a user might still might like to see help for them if, for example, they are writing a script or creating a binding. Addresses #1707. --- qutebrowser/completion/models/miscmodels.py | 4 ++-- tests/unit/completion/test_models.py | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/qutebrowser/completion/models/miscmodels.py b/qutebrowser/completion/models/miscmodels.py index bbbaa8a9d..56d436079 100644 --- a/qutebrowser/completion/models/miscmodels.py +++ b/qutebrowser/completion/models/miscmodels.py @@ -75,8 +75,8 @@ class HelpCompletionModel(base.BaseCompletionModel): assert cmdutils.cmd_dict cmdlist = [] for obj in set(cmdutils.cmd_dict.values()): - if (obj.hide or (obj.debug and not objreg.get('args').debug) or - obj.deprecated): + if ((obj.debug and not objreg.get('args').debug) or + obj.deprecated): pass else: cmdlist.append((':' + obj.name, obj.desc)) diff --git a/tests/unit/completion/test_models.py b/tests/unit/completion/test_models.py index 6772e1201..3f85c0eff 100644 --- a/tests/unit/completion/test_models.py +++ b/tests/unit/completion/test_models.py @@ -193,7 +193,7 @@ def test_help_completion(qtmodeltester, monkeypatch, stubs): """Test the results of command completion. Validates that: - - only non-hidden and non-deprecated commands are included + - only non-deprecated commands are included - commands are sorted by name - the command description is shown in the desc column - the binding (if any) is shown in the misc column @@ -211,8 +211,9 @@ def test_help_completion(qtmodeltester, monkeypatch, stubs): assert actual == [ ("Commands", [ (':drop', 'drop all user data', ''), + (':hide', '', ''), (':roll', 'never gonna give you up', ''), - (':stop', 'stop qutebrowser', '') + (':stop', 'stop qutebrowser', ''), ]), ("Settings", [ ('general->time', 'Is an illusion.', ''),