Open ammario opened 8 months ago
I had a use-case the other day, where I didn't know how to do this.
Essentially, I wanted pre-processing for all commands done on the root command, so that you can expect the correct state.
I would've put this middleware on the root command, but it has no effect: https://github.com/coder/coder/blob/f1ef9fd6737a314c4c55d4870631c8383e80bd49/scripts/release/main.go#L81. I also wouldn't want to wrap each handler that needs this pre-processing.
(PS. I think there's also a bug where you can't easily make serpent output help text if you put a Handler
on the command. I ran into a nil pointer panic.)
It serves no clear purpose beyond what could be accomplishing by just passing
serpent.Chain
to theHandler
.