hey folks, do we have existing code to handle clea...
# development
c
hey folks, do we have existing code to handle cleanup of passthrough args? ex
./pants lint testprojects/src/helm:: -- --debug
?
ArgsListOption
will handle the passthrough, I'm hoping to have some existing code for passing different args to subtasks for where it makes sense. For a concrete case, for deploying helm charts, we render the chart with
helm template
and then deploy it with `helm upgrade`; some args are only valid for the
upgrade
part, and we can filter them out of the ones we pass to
template
. Currently we only pass them through to
upgrade
, which makes sense for, ex,
--force
. But it's possible for the
template
step to fail, and then
--debug
would be helpful. See https://github.com/pantsbuild/pants/issues/18089
Actually, I probably don't need something that powerful. I could probably just have separate arglists for global and "final"-command-specific args; or separate arglists for each subcommand. Do we have a best-practice around this?
w
it’s very command specific i think… not aware of any best practice. if there are arguments that might always be necessary for particular commands, then separate arg-lists per makes sense. passthrough args need to be used sparingly: mostly for
run
,
test
, rather than necessarily for
lint
? it basically just needs to be unambiguous “who” will consume them.
c
that's a good way of looking at it, thanks. One of the quirks with helm is that you can have errors in linting, and the debug flag would be helpful. also "debug" is a global arg but you'd probably want to be able to pass it as a passthrough. I'll think of something
mhm, I tried a few things and I keep finding myself writing general argument-parser systems. I think I'm just going to special-case
--debug
so we add it to all steps. I think that's sufficient to address 99% of the usefulness without writing a fun little parser. Passing the other global Helm arguments requires more machinery and I don't think it would be that useful
w
yea, sounds reasonable.