Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Populate fields with defaults #11

Closed
Evidlo opened this issue Jul 26, 2022 · 3 comments
Closed

Feature: Populate fields with defaults #11

Evidlo opened this issue Jul 26, 2022 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@Evidlo
Copy link

Evidlo commented Jul 26, 2022

Currently it looks like Cli2Gui doesn't make use of the default argument for argparse. It would be very nice if these showed up generated GUI.

# main.py

from cli2gui import Cli2Gui
import argparse

def run(args):
    print(args.arg)

def main():
    parser = argparse.ArgumentParser(description="this is an example parser")
    parser.add_argument("--arg", type=str, default="foo", help="keyword arg")
    parser.add_argument("--bool", action='store_true', default=True, help="boolean arg")
    args = parser.parse_args()
    run(args)

decorator_function = Cli2Gui(
    run_function=run,
    auto_enable=True,
)

gui = decorator_function(main)

if __name__ == "__main__":
    gui()

out

@Evidlo Evidlo added the enhancement New feature or request label Jul 26, 2022
@FredHappyface
Copy link
Member

Hi thanks for opening the issue and apologies for the delayed response (it has been a busy couple months!)

Absolutely agreed! I'll see if I can get it implemented

@ByVictorrr
Copy link

also, it would be nice to have dynamic command to be working like adding a command on start of that super command

@FredHappyface
Copy link
Member

Not clear on what you mean? If this is a separate issue then can you create a new issue please :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants