klask icon indicating copy to clipboard operation
klask copied to clipboard

Allow automatic UI/CLI toggle setting

Open MidasLamb opened this issue 2 years ago • 3 comments

First of all, very cool lib!

It would be nice to have some way to decide whether or not the GUI should be launched based on some flag. The usecase is that distributing a tool with klask will have the benefit of having a nice CLI in case people want to automate it, or use it in scripts, but people using it less often or who aren't comfortable with the CLI get greeted with a nice GUI.

I think it could be something along the lines of: if no additional arguments are present, start the gui, otherwise run the function in run_derived with the args parsed from what the program has been invoked with. This will however have the requirement that the program takes at least one required parameter, because otherwise you cannot distinguish between a CLI invocation and an invocation to start the GUI, but that is a trade-off tool-authors will have to consider then.

MidasLamb avatar Feb 25 '22 22:02 MidasLamb

There has been some discussion about this here. Combing CLI and GUI apps easily seems to be more important to people than I thought, but I'm not really sure what option would be the best way to do it.

MichalGniadek avatar Feb 27 '22 18:02 MichalGniadek

Ah ok, I missed that! To give some more insight into why it would be useful (for me): I often create some quick tools to automate certain parts of my job or the stack I'm working on (e.g. a simulator for a particular part/behaviour), and sometimes some less tech-savy members might also want/need to use it. Currently I always have to walk them through how to use it, since it's always a CLI. If this option would exist, I would easily include Klask in all the tools, knowing that when a less savy team member double clicks it, they get greeted with a nice GUI, but the other developers can use it in their workflow and automate it easily with some scripts

MidasLamb avatar Feb 27 '22 18:02 MidasLamb

Running the GUI if no parameters are passed in, might actually work well, I will have to prototype it. For now, it's really easy to create two binaries, one for CLI and one for GUI, but I don't know if it meets your needs.

MichalGniadek avatar Feb 27 '22 19:02 MichalGniadek