[HELP] presets in clap for CLI app

Hey!

Using clap, do you know of a way to have presets, i.e. I have a CLI app with many many arguments and I want to have some presets with short names for some common settings.

for example i have the following flags

myapp --color <COLOR> --background <BACKGROUND>

and I would like to allow calling my app with these flags, or just

myapp japan-flag

which will be equivalent to

myapp --color RED --background WHITE

Thanks for helping!

It's a feature that belongs to shell, not app.

@Fiedzia can you explain?

I'm using fish, and in this case typing "red" +key up would start scrolling through history suggesting most common option. Or you could just save "japan-flag" as an alias. That way it will work with any command, not just this one.

ok, thanks! good idea

well, no good... my app is bing used as a service inside a docker container and I need a way to have few presets, using @Fiedzia suggestion will make the app start using /bin/sh and the negative result would be that the app is not with PID 1 - so seems i do have for this feature to be part of my app

If it is about providing convenience for other users I'd say leave it to them. The only change is that they will need to create alias for "docker exec ...". If for some reason you really have to handle presets at the app level, you can just add --preset / --save-preset options. Or you could set up shell as docker entry point.