BstLabs / py-dynacli

DynaCLI is a cloud-friendly Python library for converting pure Python functions into Linux Shell commands.
https://bstlabs.github.io/py-dynacli/
MIT License
98 stars 5 forks source link

[BUG] dynacli --version does not work #85

Closed asterkin closed 2 years ago

asterkin commented 2 years ago

Describe the bug A clear and concise description of what the bug is. Invoking dynacli --version results in error message

To Reproduce Steps to reproduce the behavior:


dynacli --version
usage: dynacli [-h] {init} ...
dynacli: error: unrecognized arguments: --version

**Expected behavior**
A clear and concise description of what you expected to happen.
Print the current version of dynacli library

**Screenshots**
If applicable, add screenshots to help explain your problem.
![image](https://user-images.githubusercontent.com/6297664/155278265-7c8e4074-f9bd-47ac-9d38-4ba23900135b.png)

**Extra info:**
 - OS: Ubuntu, Python 3.8.10
 - Affected Version: 1.0.5
ShahriyarR commented 2 years ago

It seems to be that with dynacli executable the __version__ is ignored, silently. It took me a lot of time to find this out.

ShahriyarR commented 2 years ago
$ python3 _cli.py --version
_cli.py - v1.0.5
$ dynacli --version
usage: dynacli [-h] {init} ...
dynacli: error: unrecognized arguments: --version

The dynacli entrypoint is created by flit according to respective PEP:

#!/usr/bin/python3.9
# -*- coding: utf-8 -*-
import re
import sys
from dynacli.bootstrap._cli import main
if __name__ == '__main__':
    sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
    sys.exit(main())