Repository: miurahr/aqtinstall
Pull request #355 (2021-08-01 20:36:35)

Fix new subcommand syntax
PR #354 introduced a few mistakes into the Azure pipelines, documentation, and help text, as noted by my comments in #354. It implemented the new command names specified by #306, but not the new syntax of those names. This PR attempts to fix these issues.


Patch:
diff --git a/aqt/installer.py b/aqt/installer.py
index 8a0cb20..e0ee538 100644
--- a/aqt/installer.py
+++ b/aqt/installer.py
@@ -72,8 +72,8 @@ class Cli:
     def __init__(self):
         parser = argparse.ArgumentParser(
             prog="aqt",
-            description="Another unoffical Qt Installer.\n"
-            "aqt help you install Qt SDK, tools, examples and others\n",
+            description="Another unofficial Qt Installer.\n"
+            "aqt helps you install Qt SDK, tools, examples and others\n",
             formatter_class=argparse.RawTextHelpFormatter,
             add_help=True,
         )
@@ -85,11 +85,11 @@ class Cli:
         )
         subparsers = parser.add_subparsers(
             title="subcommands",
-            description="aqt accept several subcommands\n"
-            "install-* subcommands are installer of components\n"
-            "list-* subcommands are show available compoenets\n\n"
-            "commands {install|tool|src|examples|doc} are oblesolete now\n",
-            help="Please refer each help message shown with --help argument for each subcommands",
+            description="aqt accepts several subcommands:\n"
+            "install-* subcommands are commands that install components\n"
+            "list-* subcommands are commands that show available components\n\n"
+            "commands {install|tool|src|examples|doc} are deprecated and marked for removal\n",
+            help="Please refer to each help message by using '--help' with each subcommand",
         )
         self._make_install_parsers(subparsers)
         self._make_list_qt_parser(subparsers)
@@ -219,6 +219,8 @@ class Cli:
         """Run install subcommand"""
         start_time = time.perf_counter()
         self.show_aqt_version()
+        if args.is_legacy:
+            self._warn_on_deprecated_command("install", "install-qt")
         arch = args.arch
         target = args.target
         os_name = args.host
@@ -330,8 +332,15 @@ class Cli:
             )
         )
 
-    def _run_src_doc_examples(self, flavor, args):
+    def _run_src_doc_examples(self, flavor, args, cmd_name: Optional[str] = None):
+        if not cmd_name:
+            cmd_name = flavor
+
         self.show_aqt_version()
+        if args.is_legacy:
+            self._warn_on_deprecated_command(
+                old_name=cmd_name, new_name=f"install-{cmd_name}"
+            )
         target = args.target
         os_name = args.host
         qt_version = args.qt_version
@@ -429,7 +438,7 @@ class Cli:
     def run_install_example(self, args):
         """Run example subcommand"""
         start_time = time.perf_counter()
-        self._run_src_doc_examples("examples", args)
+        self._run_src_doc_examples("examples", args, cmd_name="example")
         self.logger.info(
             "Time elapsed: {time:.8f} second".format(
                 time=time.perf_counter() - start_time
@@ -450,6 +459,8 @@ class Cli:
         """Run tool subcommand"""
         start_time = time.perf_counter()
         self.show_aqt_version()
+        if args.is_legacy:
+            self._warn_on_deprecated_command("tool", "install-tool")
         tool_name = args.tool_name  # such as tools_openssl_x64
         os_name = args.host  # windows, linux and mac
         target = args.target  # desktop, android and ios
@@ -613,9 +624,9 @@ class Cli:
             )
         )
 
-    def _set_install_qt_parser(self, install_qt_parser):
-        install_qt_parser.set_defaults(func=self.run_install_qt)
-        self._set_common_argument(install_qt_parser)
+    def _set_install_qt_parser(self, install_qt_parser, *, is_legacy: bool):
+        install_qt_parser.set_defaults(func=self.run_install_qt, is_legacy=is_legacy)
+        self._set_common_arguments(install_qt_parser, is_legacy=is_legacy)
         self._set_common_options(install_qt_parser)
         install_qt_parser.add_argument(
             "arch",
@@ -645,8 +656,10 @@ class Cli:
             help="No base packages; allow mod amendment with --modules option.",
         )
 
-    def _set_install_tool_parser(self, install_tool_parser):
-        install_tool_parser.set_defaults(func=self.run_install_tool)
+    def _set_install_tool_parser(self, install_tool_parser, *, is_legacy: bool):
+        install_tool_parser.set_defaults(
+            func=self.run_install_tool, is_legacy=is_legacy
+        )
         install_tool_parser.add_argument(
             "host", choices=["linux", "mac", "windows"], help="host os name"
         )
@@ -669,44 +682,53 @@ class Cli:
         self._set_common_options(install_tool_parser)
 
     def _make_legacy_parsers(self, subparsers: argparse._SubParsersAction):
+        deprecated_msg = "This command is deprecated and marked for removal in a future version of aqt."
         install_parser = subparsers.add_parser(
-            "install", formatter_class=argparse.RawTextHelpFormatter
+            "install",
+            description=deprecated_msg,
+            formatter_class=argparse.RawTextHelpFormatter,
         )
-        self._set_install_qt_parser(install_parser)
+        self._set_install_qt_parser(install_parser, is_legacy=True)
         tool_parser = subparsers.add_parser("tool")
-        self._set_install_tool_parser(tool_parser)
+        self._set_install_tool_parser(tool_parser, is_legacy=True)
         #
         for cmd, f in (
             ("doc", self.run_install_doc),
             ("example", self.run_install_example),
             ("src", self.run_install_src),
         ):
-            p = subparsers.add_parser(cmd)
-            p.set_defaults(func=f)
-            self._set_common_argument(p)
+            p = subparsers.add_parser(cmd, description=deprecated_msg)
+            p.set_defaults(func=f, is_legacy=True)
+            self._set_common_arguments(p, is_legacy=True)
             self._set_common_options(p)
             self._set_module_options(p)
 
+    def _warn_on_deprecated_command(self, old_name: str, new_name: str):
+        self.logger.warning(
+            f"Warning: The command '{old_name}' is deprecated and marked for removal in a future version of aqt.\n"
+            f"In the future, please use the command '{new_name}' instead."
+        )
+
     def _make_install_parsers(self, subparsers: argparse._SubParsersAction):
         install_qt_parser = subparsers.add_parser(
             "install-qt", formatter_class=argparse.RawTextHelpFormatter
         )
-        self._set_install_qt_parser(install_qt_parser)
+        self._set_install_qt_parser(install_qt_parser, is_legacy=False)
         tool_parser = subparsers.add_parser("install-tool")
-        self._set_install_tool_parser(tool_parser)
+        self._set_install_tool_parser(tool_parser, is_legacy=False)
         #
         for cmd, f in (
             ("install-doc", self.run_install_doc),
             ("install-example", self.run_install_example),
         ):
             p = subparsers.add_parser(cmd)
-            p.set_defaults(func=f)
-            self._set_common_argument(p)
+            p.set_defaults(func=f, is_legacy=False)
+            self._set_common_arguments(p, is_legacy=False)
             self._set_common_options(p)
             self._set_module_options(p)
         src_parser = subparsers.add_parser("install-src")
-        src_parser.set_defaults(func=self.run_install_src)
-        self._set_common_argument(src_parser)
+        src_parser.set_defaults(func=self.run_install_src, is_legacy=False)
+        self._set_common_arguments(src_parser, is_legacy=False)
         self._set_common_options(src_parser)
         self._set_module_options(src_parser)
         src_parser.add_argument(
@@ -875,14 +897,25 @@ class Cli:
             help="Specify subset packages to install (Default: all standard and extra modules).",
         )
 
-    def _set_common_argument(self, subparser):
-        subparser.add_argument("qt_version", help='Qt version in the format of "5.X.Y"')
+    def _set_common_arguments(self, subparser, *, is_legacy: bool):
+        """
+        Legacy commands require that the version comes before host and target.
+        Non-legacy commands require that the host and target are before the version.
+        """
+        if is_legacy:
+            subparser.add_argument(
+                "qt_version", help='Qt version in the format of "5.X.Y"'
+            )
         subparser.add_argument(
             "host", choices=["linux", "mac", "windows"], help="host os name"
         )
         subparser.add_argument(
             "target", choices=["desktop", "winrt", "android", "ios"], help="target sdk"
         )
+        if not is_legacy:
+            subparser.add_argument(
+                "qt_version", help='Qt version in the format of "5.X.Y"'
+            )
 
     def _setup_settings(self, args=None):
         # setup logging
diff --git a/ci/generate_azure_pipelines_matrices.py b/ci/generate_azure_pipelines_matrices.py
index 03e64aa..fd07338 100644
--- a/ci/generate_azure_pipelines_matrices.py
+++ b/ci/generate_azure_pipelines_matrices.py
@@ -164,16 +164,16 @@ linux_build_jobs.extend(
             "install-doc", "6.1.0", "linux", "desktop", "gcc_64", "gcc_64", subarchives="qtdoc"
         ),
         # test for list commands
-        BuildJob('list-qt', '5.15.2', 'linux', 'desktop', '', '', spec="<6", list_options={
+        BuildJob('list', '5.15.2', 'linux', 'desktop', '', '', spec="<6", list_options={
             'HAS_EXTENSIONS': "True",
         }),
-        BuildJob('list-qt', '6.1.0', 'linux', 'android', '', '', spec=">6.0,<6.1.1", list_options={
+        BuildJob('list', '6.1.0', 'linux', 'android', '', '', spec=">6.0,<6.1.1", list_options={
             'HAS_EXTENSIONS': "True",
             'USE_EXTENSION': "armv7",
         }),
         # tests run on linux but query data about other platforms
-        BuildJob('list-qt', '5.14.1', 'mac', 'ios', '', '', spec="<=5.14.1", list_options={}),
-        BuildJob('list-qt', '5.13.1', 'windows', 'winrt', '', '', spec=">5.13.0,<5.13.2", list_options={}),
+        BuildJob('list', '5.14.1', 'mac', 'ios', '', '', spec="<=5.14.1", list_options={}),
+        BuildJob('list', '5.13.1', 'windows', 'winrt', '', '', spec=">5.13.0,<5.13.2", list_options={}),
     ]
 )
 mac_build_jobs.extend(
diff --git a/ci/steps.yml b/ci/steps.yml
index bb22a7e..996902f 100644
--- a/ci/steps.yml
+++ b/ci/steps.yml
@@ -35,12 +35,12 @@ steps:
         if [[ "$(SUBARCHIVES)" != "" ]]; then
           opt+=" --archives $(SUBARCHIVES)"
         fi
-        python -m aqt install-qt $(QT_VERSION) $(HOST) $(TARGET) $(ARCH) $opt
+        python -m aqt install-qt $(HOST) $(TARGET) $(QT_VERSION) $(ARCH) $opt
         if [[ "$(TARGET)" == "android" || "$(TARGET)" == "ios" ]]; then
           if [[ "$(HOST)" == "windows" ]]; then
-            python -m aqt install-qt $(QT_VERSION) $(HOST) desktop mingw81_64 --archives qtbase
+            python -m aqt install-qt $(HOST) desktop $(QT_VERSION) mingw81_64 --archives qtbase
           else
-            python -m aqt install-qt $(QT_VERSION) $(HOST) desktop --archives qtbase
+            python -m aqt install-qt $(HOST) desktop $(QT_VERSION) --archives qtbase
           fi
         fi
         if [[ "$(OUTPUT_DIR)" != "" ]]; then
@@ -99,10 +99,10 @@ steps:
         aqt list-qt $(HOST) $(TARGET) $ext --spec "$(SPEC)" --arch latest
       fi
       if [[ "$(SUBCOMMAND)" == "install-src" ]]; then
-        python -m aqt $(SUBCOMMAND) $(QT_VERSION) $(HOST) $(TARGET) --archives $(SUBARCHIVES)
+        python -m aqt $(SUBCOMMAND) $(HOST) $(TARGET) $(QT_VERSION) --archives $(SUBARCHIVES)
       fi
       if [[ "$(SUBCOMMAND)" == "install-doc" ]]; then
-        python -m aqt $(SUBCOMMAND) $(QT_VERSION) $(HOST) $(TARGET) --archives $(SUBARCHIVES)
+        python -m aqt $(SUBCOMMAND) $(HOST) $(TARGET) $(QT_VERSION) --archives $(SUBARCHIVES)
       fi
     workingDirectory: $(Build.BinariesDirectory)
     env:
@@ -128,7 +128,7 @@ steps:
       export PATH=$(QT_BINDIR):$PATH
       qmake $(Build.BinariesDirectory)/tests/accelbubble
       make
-    condition: and(eq(variables['TARGET'], 'android'), or(eq(variables['Agent.OS'], 'Linux'), eq(variables['Agent.OS'], 'Darwin')), ne(variables['SUBCOMMAND'], 'list-qt'))
+    condition: and(eq(variables['TARGET'], 'android'), or(eq(variables['Agent.OS'], 'Linux'), eq(variables['Agent.OS'], 'Darwin')), ne(variables['SUBCOMMAND'], 'list'))
     displayName: Build accelbubble example application to test for android
 
   - script: |
diff --git a/docs/cli.rst b/docs/cli.rst
index 39b18bc..9bbdeae 100644
--- a/docs/cli.rst
+++ b/docs/cli.rst
@@ -159,15 +159,11 @@ Qt Installation command
 
 .. code-block:: bash
 
-    aqt install-qt <Qt version> <target OS> <target variant> [<target architecture>]
+    aqt install-qt <target OS> <target variant> <Qt version> [<target architecture>]
 
 install Qt library specified version and target.
 There are various combinations to accept according to Qt version.
 
-.. describe:: Qt version
-
-    This is a Qt version such as 5.9,7, 5.12.1 etc
-
 .. describe:: target OS
 
     linux, windows or mac
@@ -176,6 +172,10 @@ There are various combinations to accept according to Qt version.
 
     desktop, ios or android
 
+.. describe:: Qt version
+
+    This is a Qt version such as 5.9,7, 5.12.1 etc
+
 .. describe:: target architecture
 
    * gcc_64 for linux desktop
@@ -233,15 +233,11 @@ Source installation command
 
 .. code-block:: bash
 
-    aqt install-src <Qt version> <target OS> <target variant> [--kde] [--archives <archive>]
+    aqt install-src <target OS> <target variant> <Qt version> [--kde] [--archives <archive>]
 
 install Qt sources specified version and target.
 
 
-.. describe:: Qt version
-
-    This is a Qt version such as 5.9,7, 5.12.1 etc
-
 .. describe:: target OS
 
     linux, windows or mac
@@ -250,6 +246,10 @@ install Qt sources specified version and target.
 
     desktop, ios or android
 
+.. describe:: Qt version
+
+    This is a Qt version such as 5.9,7, 5.12.1 etc
+
 .. option:: --kde
 
     by adding --kde option,
@@ -269,14 +269,10 @@ Document installation command
 
 .. code-block:: bash
 
-    aqt install-doc <Qt version> <target OS> <target variant>
+    aqt install-doc <target OS> <target variant> <Qt version>
 
 install Qt documents specified version and target.
 
-.. describe:: Qt version
-
-    This is a Qt version such as 5.9,7, 5.12.1 etc
-
 .. describe:: target OS
 
     linux, windows or mac
@@ -285,6 +281,10 @@ install Qt documents specified version and target.
 
     desktop, ios or android
 
+.. describe:: Qt version
+
+    This is a Qt version such as 5.9,7, 5.12.1 etc
+
 
 Example installation command
 ----------------------------
@@ -293,15 +293,11 @@ Example installation command
 
 .. code-block:: bash
 
-    aqt install-example <Qt version> <target OS> <target variant>
+    aqt install-example <target OS> <target variant> <Qt version>
 
 install Qt examples specified version and target.
 
 
-.. describe:: Qt version
-
-    This is a Qt version such as 5.9,7, 5.12.1 etc
-
 .. describe:: target OS
 
     linux, windows or mac
@@ -310,6 +306,10 @@ install Qt examples specified version and target.
 
     desktop, ios or android
 
+.. describe:: Qt version
+
+    This is a Qt version such as 5.9,7, 5.12.1 etc
+
 
 .. _tools installation command:
 
@@ -353,30 +353,30 @@ Example: Installing Qt SDK 5.12.0 for Linux with QtCharts and QtNetworkAuth:
 .. code-block:: console
 
     pip install aqtinstall
-    sudo aqt install-qt --outputdir /opt 5.12.0 linux desktop -m qtcharts qtnetworkauth
+    sudo aqt install-qt --outputdir /opt linux desktop 5.12.0 -m qtcharts qtnetworkauth
 
 
 Example: Installing Android (armv7) Qt 5.10.2:
 
 .. code-block:: console
 
-    aqt install-qt 5.10.2 linux android android_armv7
+    aqt install-qt linux android 5.10.2 android_armv7
 
 
 Example: Install examples, doc and source:
 
 .. code-block:: console
 
-    aqt install-example 5.15.2 windows desktop -m qtcharts qtnetworkauth
-    aqt install-doc 5.15.2 windows desktop -m qtcharts qtnetworkauth
-    aqt install-src 5.15.2 windows desktop --archives qtbase --kde
+    aqt install-example windows desktop 5.15.2 -m qtcharts qtnetworkauth
+    aqt install-doc windows desktop 5.15.2 -m qtcharts qtnetworkauth
+    aqt install-src windows desktop 5.15.2 --archives qtbase --kde
 
 
 Example: Install Web Assembly
 
 .. code-block:: console
 
-    aqt install-qt 5.15.0 linux desktop wasm_32
+    aqt install-qt linux desktop 5.15.0 wasm_32
 
 
 Example: List available versions of Qt on Linux
diff --git a/docs/installation.rst b/docs/installation.rst
index 21d984e..95ecf56 100644
--- a/docs/installation.rst
+++ b/docs/installation.rst
@@ -28,32 +28,35 @@ Same as usual, it can be installed with `pip`
 Command changes
 ===============
 
-From version 2.0.0, sub commands are changed. There has also been legacy commands for backward compatibility
-but are not recommended now.
-
-+----------------- -+---------------------+------------------------+
-| New sub commands  | Legacy sub commands |  Note                  |
-+===================+=====================+========================+
-| install-qt        | install             |                        |
-+----------------- -+---------------------+------------------------+
-| install-tool      | tool                | Arguments are changed  |
-|                   |                     | new syntax doesn't take|
-|                   |                     | version                |
-+----------------- -+---------------------+------------------------+
-| install-example   | examples            | caution with last (s)  |
-+----------------- -+---------------------+------------------------+
-| install-src       | src                 | New command only can   |
-|                   |                     | take --kde option      |
-+----------------- -+---------------------+------------------------+
-| install-doc       | doc                 |                        |
-+----------------- -+---------------------+------------------------+
-|                   | list                | legacy list command are|
-|                   |                     | deprecated.            |
-+----------------- -+---------------------+------------------------+
-| list-qt           |                     |                        |
-+----------------- -+---------------------+------------------------+
-| list-tool         |                     |                        |
-+----------------- -+---------------------+------------------------+
+From version 2.0.0, sub commands are changed.
+The previous versions of these sub commands have been retained for backwards
+compatibility, but are no longer recommended.
+
++----------------- -+---------------------+----------------------------+
+| New sub commands  | Legacy sub commands |  Note                      |
++===================+=====================+============================+
+| install-qt        | install             | version moved after target |
++----------------- -+---------------------+----------------------------+
+| install-tool      | tool                | Arguments are changed      |
+|                   |                     | new syntax doesn't take    |
+|                   |                     | version                    |
++----------------- -+---------------------+----------------------------+
+| install-example   | examples            | version moved after target |
+|                   |                     | caution with last (s)      |
++----------------- -+---------------------+----------------------------+
+| install-src       | src                 | version moved after target |
+|                   |                     | New command only can       |
+|                   |                     | take --kde option          |
++----------------- -+---------------------+----------------------------+
+| install-doc       | doc                 | version moved after target |
++----------------- -+---------------------+----------------------------+
+|                   | list                | legacy list commands are   |
+|                   |                     | removed.                   |
++----------------- -+---------------------+----------------------------+
+| list-qt           |                     |                            |
++----------------- -+---------------------+----------------------------+
+| list-tool         |                     |                            |
++----------------- -+---------------------+----------------------------+
 
 
 Usage
@@ -64,14 +67,15 @@ General usage looks like this:
 .. code-block:: bash
 
     aqt [-h][--help][-O | --outputdir <directory>][-b | --base <mirror url>][-E | --external <7zip command>] \
-        install-qt <qt-version> <host> <target> [<arch>] [-m all | -m [extra module] [extra module]...] [--internal]
+        install-qt <host> <target> <qt-version> [<arch>] [-m all | -m [extra module] [extra module]...] [--internal]
         [--archives <archive>[ <archive>...]] [--timeout <timeout(sec)>]
 
 You can also call with ``python -m aqt`` syntax as well as command script ``aqt``.
+Some older operating systems may require you to specify Python version 3, like this: ``python3 -m aqt``.
 
-* The Qt version is formatted like this: `5.11.3`
 * Host is one of: `linux`, `mac`, `windows`
 * Target is one of: `desktop`, `android`, `ios` (iOS only works with mac host)
+* The Qt version is formatted like this: `5.11.3`
 * For some platforms you also need to specify an arch:
     * For windows, choose one of:
         * `win64_msvc2019_64`, `win32_msvc2019`,
@@ -91,20 +95,19 @@ You can also call with ``python -m aqt`` syntax as well as command script ``aqt`
 Installing tool and utility (Experimental)
 ------------------------------------------
 
-You can install tools and utilities using following syntax;
+You can install tools and utilities using the :ref:`tools installation command`:
 
 .. code-block:: bash
 
     python -m aqt [-h][--help][-O | --outputdir <directory>][-b | --base <mirror url>][-E | --external <7zip command>] \
-        install-tool <host> <tool_name> <tool-version> <arch> [--timeout <timeout>]
+        install-tool <host> <target> <tool_name> [<arch>] [--timeout <timeout>]
 
 * tool_name is one of `tools_ifw`, `tools_vcredist`, and `tools_openssl`.
-* arch is full qualified tool name such as `qt.tools.ifw.31` which values can be seen on Qt `archive_site`_
+* arch is full qualified tool name such as `qt.tools.ifw.31`.
+  Please use :ref:`aqt list-tool <list tool command>` to list acceptable values for this parameter.
   This is a quite experimental feature, may not work and please use it with your understanding of what you are doing.
 * It does not recognize 'installscript.qs'. When using tools which depends on a qt script, you should do something by yourself.
 
-.. _`archive_site`: https://download.qt.io/online/qtsdkrepository/linux_x64/desktop/tools_ifw/
-
 
 Target directory
 ----------------
@@ -118,4 +121,4 @@ run such as follows:
 .. code-block:: bash
 
     C:\> mkdir Qt
-    C:\> aqt install --outputdir c:\Qt 5.11.3 windows desktop win64_msvc2019_64
+    C:\> aqt install-qt --outputdir c:\Qt windows desktop 5.11.3 win64_msvc2019_64


Test patch:
diff --git a/tests/test_cli.py b/tests/test_cli.py
index 98e40d7..755568d 100644
--- a/tests/test_cli.py
+++ b/tests/test_cli.py
@@ -15,8 +15,8 @@ def test_cli_help(capsys):
             "install,tool,doc,example,src,help,version}\n",
             "           ...\n",
             "\n",
-            "Another unoffical Qt Installer.\n",
-            "aqt help you install Qt SDK, tools, examples and others\n",
+            "Another unofficial Qt Installer.\n",
+            "aqt helps you install Qt SDK, tools, examples and others\n",
             "\n",
             "optional arguments:\n",
             "  -h, --help            show this help message and exit\n",
@@ -24,15 +24,15 @@ def test_cli_help(capsys):
             "                        Configuration ini file.\n",
             "\n",
             "subcommands:\n",
-            "  aqt accept several subcommands\n",
-            "  install-* subcommands are installer of components\n",
-            "  list-* subcommands are show available compoenets\n",
+            "  aqt accepts several subcommands:\n",
+            "  install-* subcommands are commands that install components\n",
+            "  list-* subcommands are commands that show available components\n",
             "  \n",
-            "  commands {install|tool|src|examples|doc} are oblesolete now\n",
+            "  commands {install|tool|src|examples|doc} are deprecated and marked for removal\n",
             "\n",
             "  {install-qt,install-tool,install-doc,install-example,install-src,list-qt,list-tool,",
             "install,tool,doc,example,src,help,version}\n",
-            "                        Please refer each help message shown with --help argument for each subcommands\n",
+            "                        Please refer to each help message by using '--help' with each subcommand\n",
         ]
     )
     cli = Cli()
@@ -87,8 +87,8 @@ def test_cli_invalid_version(capsys, invalid_version):
     )
 
     for cmd in (
-        ("install-qt", invalid_version, "mac", "desktop"),
-        ("install-doc", invalid_version, "mac", "desktop"),
+        ("install-qt", "mac", "desktop", invalid_version),
+        ("install-doc", "mac", "desktop", invalid_version),
         ("list-qt", "mac", "desktop", "--modules", invalid_version),
     ):
         with pytest.raises(SystemExit) as pytest_wrapped_e:
@@ -106,7 +106,7 @@ def test_cli_check_mirror():
     cli = Cli()
     cli._setup_settings()
     assert cli._check_mirror(None)
-    arg = ["install", "5.11.3", "linux", "desktop", "-b", "https://download.qt.io/"]
+    arg = ["install-qt", "linux", "desktop", "5.11.3", "-b", "https://download.qt.io/"]
     args = cli.parser.parse_args(arg)
     assert args.base == "https://download.qt.io/"
     assert cli._check_mirror(args.base)
diff --git a/tests/test_connection.py b/tests/test_connection.py
index 0b358a1..8b0e96a 100644
--- a/tests/test_connection.py
+++ b/tests/test_connection.py
@@ -12,7 +12,7 @@ def test_cli_unknown_version(capsys):
     wrong_url_ending = "mac_x64/desktop/qt5_5160/Updates.xml"
     with pytest.raises(SystemExit) as pytest_wrapped_e:
         cli = aqt.installer.Cli()
-        cli.run(["install", wrong_version, "mac", "desktop"])
+        cli.run(["install-qt", "mac", "desktop", wrong_version])
     assert pytest_wrapped_e.type == SystemExit
     assert pytest_wrapped_e.value.code == 1
     out, err = capsys.readouterr()