RedHatQE / pylero

Python wrapper for the Polarion WSDL API
https://redhatqe.github.io/pylero/
MIT License
37 stars 25 forks source link

CLI help message should be displayed #107

Closed waynesun09 closed 1 year ago

waynesun09 commented 2 years ago

If user doesn't provide the pylero config file

$ pylero --help
Traceback (most recent call last):
  File "/usr/bin/pylero", line 39, in <module>
    main()
  File "/usr/bin/pylero", line 30, in main
    imp_mod = __import__("pylero.{0}".format(the_mod), fromlist=[""])
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/pylero/build.py", line 8, in <module>
    from pylero.build_linked_work_item import ArrayOfBuildLinkedWorkItem
  File "/usr/lib/python3.11/site-packages/pylero/build_linked_work_item.py", line 9, in <module>
    from pylero.work_item import _WorkItem
  File "/usr/lib/python3.11/site-packages/pylero/work_item.py", line 1580, in <module>
    cfg = Configuration()
          ^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/pylero/base_polarion.py", line 105, in __init__
    raise PyleroLibException(
pylero.exceptions.PyleroLibException: The config files must contain valid values for: url, user, password and default_project

$ pylero-cmd --help
Traceback (most recent call last):
  File "/usr/bin/pylero-cmd", line 3, in <module>
    from pylero.cli.cmd import CmdList
  File "/usr/lib/python3.11/site-packages/pylero/cli/cmd.py", line 9, in <module>
    from pylero.document import Document
  File "/usr/lib/python3.11/site-packages/pylero/document.py", line 24, in <module>
    from pylero.work_item import _WorkItem
  File "/usr/lib/python3.11/site-packages/pylero/work_item.py", line 1580, in <module>
    cfg = Configuration()
          ^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/pylero/base_polarion.py", line 105, in __init__
    raise PyleroLibException(
pylero.exceptions.PyleroLibException: The config files must contain valid values for: url, user, password and default_project

Together with a lack of a manpage, it's a bit hard to understand how to provide the config. It's in the README, but I'd expect --help to work.

waynesun09 commented 1 year ago

For the pylero-cmd sub commands could we also do something when the config does not exist For example:

$ pylero-cmd list --help
Traceback (most recent call last):
  File "/home/waynesun/.local/share/virtualenvs/pylero-xZ4TB2uX/bin/pylero-cmd", line 49, in <module>
    from pylero.cli.cmd import CmdList
  File "/home/waynesun/.local/share/virtualenvs/pylero-xZ4TB2uX/lib/python3.10/site-packages/pylero/cli/cmd.py", line 9, in <module>
    from pylero.document import Document
  File "/home/waynesun/.local/share/virtualenvs/pylero-xZ4TB2uX/lib/python3.10/site-packages/pylero/document.py", line 24, in <module>
    from pylero.work_item import _WorkItem
  File "/home/waynesun/.local/share/virtualenvs/pylero-xZ4TB2uX/lib/python3.10/site-packages/pylero/work_item.py", line 1580, in <module>
    cfg = Configuration()
  File "/home/waynesun/.local/share/virtualenvs/pylero-xZ4TB2uX/lib/python3.10/site-packages/pylero/base_polarion.py", line 105, in __init__
    raise PyleroLibException(
pylero.exceptions.PyleroLibException: The config files must contain valid values for: url, user, password and default_project