Hi,
Recently while fixing #959 and making glob pattern matching more
consistent across the board, it became apparent that some artifact
commands have ambiguous meanings when given glob patterns, as such we
opened a follow up issue #1411[0]
My take on this is that the root of the issue is that we have some
ambiguity when collecting user input from the command line, inasmuch as
we allow the user to specify targets without explicitly informing us
whether the targets are artifact names or element names.
To rectify the issue, I propose that we add a (multiple) `--element`
option to the `bst artifact` commands, allowing the user to specify
element names using this switch, and leaving the remaining [TARGETS...]
argument to be only interpreted as artifact names.
One rationale for this, is that:
* The artifact commands are created to interact with artifacts, this
is the primary function of artifact commands.
* Allowing one to specify an element name is really just an added
convenience.
If the user wants to interact with artifacts bearing the cache
keys corresponding to an active project tree, this convenience
allows them to skip the step of constructing the artifact
name (by invoking `bst show --format '%{full-key}' element.bst`
first).
Most artifact commands currently accept multiple targets, there remains
however `bst artifact checkout` which only accepts one argument - this
argument would become optional, and the user could specify an element
name instead of an artifact name with the `--element` option, e.g.:
bst artifact checkout --element element.bst
Commands which support operations on multiple artifacts, would support
multiple `--element` specifications, and continue to support wildcards,
such as:
bst artifact show \
--element element1.bst \
--element element2.bst \
--element "subsystem/stage1*"
This would be a breaking change, but would cause the `bst artifact`
command subgroup to have more predictable results, by causing the user
input to be more specific.
Thoughts ?
Cheers,
-Tristan
[0] https://github.com/apache/buildstream/issues/1411