0

I'm working on a shell script that handles the build of several applications.

It features a configuration file that describes several possible builds: iOS-debug, iOS-release, android-all-arch-debug, android-all-arch-release, android-armeabi-v7a-debug, etc. Each build might have a different command to invoke, specific parameters, some post-build operations (apk signing for example).

The aim of this configuration file is to ask the user what he wants to build, and these options are not mutually exclusive. Basically, each selected option is placed in a queue and they're all built one by one, and placed in their respective output directories.

Using a graphical interface, you can just offer the user a checklist with one entry per option. Using a command line interface... It's a bit harder.

The solution that comes to mind is the following:

Select the targets to build:

[a] iOS-debug
[b] iOS-release
[c] android-all-arch-debug
[d] android-all-arch-release
[e] android-armeabi-v7a-debug

Your choice(s): abcde

In this solution, each option is represented by a single character (which leaves room for more options), and it's both clear to the user and easy to parse for the developper.

But this isn't really user-friendly or obvious to use, so I'd like to know.

Is there an idiomatic way to implement such a UI? Is there a better way?

Thanks in advance.

  • As far as user selection of options and choices, you could make use of the bash shell's builtin `getopt` functionality. To get fancier on a terminal, you could make use of the `ncurses` package. – Roadowl Jul 16 '19 at 15:59
  • Also you might want to look into the program `dialog`. It may even be installed on your system (try `dialog --title test --yesno "destroy world" 6 20`). – Roadowl Jul 16 '19 at 16:57
  • Or check out the `select` command, here's an example : https://stackoverflow.com/a/226724/620097 . Good luck. – shellter Jul 17 '19 at 03:29

0 Answers0