[BuildStream] bst shell multiple element command-line syntax



Greetings BuildStream comrades.

I'm looking at https://gitlab.com/BuildStream/buildstream/issues/422
(`bst shell` should be able to stage the specified element on top of a base element)
with the aim of being able to construct a shell from multiple elements
as listed on the command-line.

My current approach is looking like for single-element use:

    bst shell hello.bst -- /bin/sh -c 'echo Hello World'

While for multi-element use it will look like:

    bst shell -e hello.bst -e goodbye.bst -- /bin/sh -c 'echo Hello and Goodbye'

i.e. For a single element it can be listed as an argument as-before,
but if multiple elements will be selected it must be passed as an option.

This is because BuildStream uses click for command-line parsing,
and it doesn't support having options that take variadic arguments,
or multiple variadic arguments,
and the `--` token argument is consumed and discarded
so I can't use it to manually parse when elements end and the command begins.

I also didn't want to have a heuristic decide to split elements from command
by whether they looked like an element or a command
since it's just convention that our element files end with .bst,
and it's not impossible to have a command with the same name in PATH.

Arguably switching to a different command-line parser is an option,
but that's a large undertaking for marginal benefit,
compounded by having to find replacements
for the bash completion and documentation generation.

-- 
Codethink Ltd., 3rd Floor, Dale House, 35 Dale Street, MANCHESTER, M1 2HF.
https://www.codethink.co.uk/privacy.html


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]