matyalatte / tuw

Tiny GUI wrapper for command-line tools
MIT License
23 stars 2 forks source link

Support affixes #48

Closed matyalatte closed 3 days ago

matyalatte commented 4 days ago

Related to #23.

You can append strings to user inputs with "prefix" and "suffix". Also, "optional": true ignores "add_quotes", "prefix", "suffix", and "validator" when a text box is empty.

optional

Affix

{
    "gui": [
        {
            "label": "Optional component",
            "command": "echo %-%",
            "components": [
                {
                    "type": "text",
                    "label": "Text box",
                    "optional": true,
                    "prefix": "-pre=",
                    "suffix": " -suf",
                    "validator": {
                        "regex": ".+"
                    }
                }
            ]
        }
    ]
}