matyalatte / tuw

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

Support affixes #48

Closed matyalatte closed 2 months ago

matyalatte commented 2 months 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": ".+"
                    }
                }
            ]
        }
    ]
}