Repository: buildtesters/buildtest (language: python)

Issue:
remove 'buildtest help' and 'buildtest h' from tab completion 



Discussion / hints:

Fix patch:
diff --git a/bash_completion.sh b/bash_completion.sh
index 0c6bd5e46..8b2ef54d5 100644
--- a/bash_completion.sh
+++ b/bash_completion.sh
@@ -456,9 +456,10 @@ _buildtest ()
       COMPREPLY=( $( compgen -W "${cmds}" -- $cur ) )
       ;;
     *)
-      local cmds="build buildspec cd cdash clean config debugreport docs info inspect history path report schema schemadocs show stats stylecheck tutorial-examples unittests"
-      local alias_cmds="bd bc cg debug it hy rt s style test"
-      local opts="--color --config --debug --editor --help --helpcolor --help-all --logpath --loglevel --print-log --no-color --report --version --view-log -c -d -h -l -p -r -H -V"
+      local cmds="build buildspec cd cdash clean commands config debugreport docs history info inspect path report schema schemadocs show stats stylecheck tutorial-examples unittests"
+      local alias_cmds="bd bc cg cmd debug hy it rt s style test"
+      local opts="--color --config --debug --editor --help --helpcolor --help-all --loglevel --logpath --no-color --print-log --report --version --view-log -c -d -h -l -p -r -H -V"
+
 
       case "${cur}" in
       # print main options to buildtest


Test patch:
diff --git a/buildtest/cli/__init__.py b/buildtest/cli/__init__.py
index a3b23829b..00f655adf 100644
--- a/buildtest/cli/__init__.py
+++ b/buildtest/cli/__init__.py
@@ -410,6 +410,10 @@ def misc_menu(subparsers):
         help="Show help message for command",
     )
 
+    subparsers.add_parser(
+        "commands", help="Display buildtest commands", aliases=["cmd"]
+    )
+
 
 def stylecheck_menu(subparsers):
     """This method will create command options for ``buildtest stylecheck``
diff --git a/buildtest/cli/commands.py b/buildtest/cli/commands.py
new file mode 100644
index 000000000..8ce0f7cb6
--- /dev/null
+++ b/buildtest/cli/commands.py
@@ -0,0 +1,29 @@
+def list_buildtest_commands():
+    """This method implements command ``buildtest commands`` which shows a list of buildtest commands"""
+
+
+cmds_list = [
+    "build",
+    "buildspec",
+    "cd",
+    "cdash",
+    "clean",
+    "config",
+    "debugreport",
+    "docs",
+    "history",
+    "info",
+    "inspect",
+    "path",
+    "report",
+    "schema",
+    "schemadocs",
+    "show",
+    "stats",
+    "stylecheck",
+    "tutorial-examples",
+    "unittests",
+]
+
+for field in cmds_list:
+    print(field)
diff --git a/buildtest/main.py b/buildtest/main.py
index cf223fe4f..a58bbeafa 100644
--- a/buildtest/main.py
+++ b/buildtest/main.py
@@ -22,6 +22,7 @@
 from buildtest.cli.cd import change_directory
 from buildtest.cli.cdash import upload_test_cdash, view_cdash_project
 from buildtest.cli.clean import clean
+from buildtest.cli.commands import list_buildtest_commands
 from buildtest.cli.compilers import compiler_cmd
 from buildtest.cli.config import config_cmd
 from buildtest.cli.debugreport import print_debug_report
@@ -372,6 +373,9 @@ def main():
             apply_stylechecks=args.apply,
         )
 
+    elif args.subcommands in ["commands", "cmd"]:
+        list_buildtest_commands()
+
 
 if __name__ == "__main__":
     main()
diff --git a/tests/cli/test_commands.py b/tests/cli/test_commands.py
new file mode 100644
index 000000000..286eadba6
--- /dev/null
+++ b/tests/cli/test_commands.py
@@ -0,0 +1,5 @@
+from buildtest.cli.commands import list_buildtest_commands
+
+
+def test_buildtest_commands():
+    list_buildtest_commands()