Selectors
Interactive selectors based on gum's chooser are something of a primitive for compose.mk
. This page covers these main use-cases for stand-alone mode:
For lower-level programmatic usage see instead the user-input section of the standard-lib docs. For higher-level usage like apps with layered dialogs, see the examples in the advanced TUI docs.
Interactive Target-Selection
Given any random Makefile, compose.mk
can wrap it with runner that offers target-selection using the mk.select/<path_to_makefile> target.
For testing in situations like this, there is a lightweight Makefile included in the repository, aka demos/no-includes.mk. Like the name suggests, it doesn't actually include or use compose.mk
in any way. You can launch this target-selector once, or use flux.loopf/<target_name> for a simple looping runner.
# Select target and run once
$ ./compose.mk mk.select/demos/no-include.mk
# Looping runner
$ ./compose.mk flux.loopf/mk.select/demos/no-include.mk
Interactive Container-Selection
Given any random docker compose file, compose.mk
can wrap it with runner that offers container-selection, using compose.select/<path_to_compose_file>.
For testing in situations like this the repo ships with a sample compose file, aka demos/data/docker-compose.minimal.yml, so we'll use that here.
$ ./compose.mk compose.select/demos/data/docker-compose.minimal.yml
After selecting a service, you'll be dropped into an interactive shell for that container.
This should work for most containers regardless of their default entrypoint, and compose.mk
can help to autodetect whether using bash
or sh
is appropriate. If there's no shell at all available in the container though, you're out of luck!
As with the mk.select
example above, we can use flux.loopf/<target_name> to easily turn this into a a simple looping interface:
$ ./compose.mk \
flux.loopf/compose.select/demos/data/docker-compose.minimal.yml