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] no dash to underscore conversion in **kwargs #97

Closed asterkin closed 2 years ago

asterkin commented 2 years ago

Describe the bug In clvm redirect stop checks for keep_instance in **kwargs. If command line contains keep-instance=True, it won;t work.

To Reproduce Steps to reproduce the behavior: ./clvm redirect start caios-dev--desktop (will redirect 8080 by default) ./clvm redirect stop caios-dev--desktop keep-instance=True

Expected behavior Should aoutomatically convert - to _ (which is correct python arg name btw)

Screenshots If applicable, add screenshots to help explain your problem.

Extra info:

ShahriyarR commented 2 years ago

As per my tests:

def start(name: str, **kwargs: str) -> None:
    """
        Start something new

        Args:
            name (str): name of the start
            **kwargs (str): pass some keyword arguments

        Return: None
    """

    print(name, kwargs)
$ ./testclinested feature-Z start name extra-arg="wohoo"
name {'extra-arg': 'wohoo'}

$ ./testclinested feature-Z start name extra_arg="wohoo"
name {'extra_arg': 'wohoo'}

So basically you want that all passed arguments with dash converted to the underscore?