Can't purge multiple snaps

If you want to remove (and purge) a bunch of snaps, you’d expect to be able to snap remove --purge snapa snapb snapc but this errors:
error: a single snap name is needed to specify options

I have to for s in snapa snapb snapc; do snap remove --purge $s; done which seems a bit obtuse.

Would it not make sense to allow bulk operations like remove to work with --purge option?

i bet it works if you drop the --purge :wink:

seems to be a shortcoming of the option parser …

You’re missing the point. I want to purge.

i know you do … just pointing at the possible bug here :slight_smile: i’d file an LP bug …

Yes it makes sense to do this, I think we already have an LP bug about this but we haven’t had time to work on this yet unfortunately

Ditto for --beta/--candidate/--edge and --classic, at least as of the last time I tried them (when setting up a new machine and installing a long list of snaps all at once).

I’m not entirely sure if answer to this one is as simple as it seems. If I specify:

snap install --beta foo bar baz

Does it mean:

  • all snaps get the beta channel
  • only foo snap is from beta?

Say we make those options positional, then what is the interpretation of:

snap install --beta foo --stable bar --edge

foo is beta or stable? bar is edge or stable? Should the optionl be specified before or after? How does one discover the right order on the first try?

And lastly classic. Since that it means that the snap is unconfined and can do whatever, I think it should be a conscious choice and this require little more effort to type snap install --classic foo.

Yeah, fair enough. Personally, I think I’d only assume the flag applies to the whole command, but it is potentially ambiguous. I easily changed my install script to just have one snap command for each non-default install…

I’m coming from a history of using apt, where you can apt install foo bar baz and equally apt remove foo bar baz and even apt remove --purge foo bar baz. So it’s a bit odd that this well established behaviour didn’t get carried over IMO.

1 Like

Yes, I think we should address this and make --purge work with multiple snaps.