New `snap switch` command

During one of the recent conferences the topic of snap switch came up. The idea is that there should be a command that lets can switch the channel of a snap easily without refreshing to it right away. The functionality is largely provided by snap refresh --channel=$CHANNEL $SNAP. But the later will always do a refresh and only switch the channel if the refresh worked. In some cases (airplane with no network) it may be desirable to just switch for later.

Small branch with this feature:

1 Like

how would that work if the revision does not actually exist in the target channel … would it switch back to the former channel once you are back online ? would it stay on that channel with a non-existing revision and hope that a higher one comes up eventually ?

1 Like

The answer is the same as what happens when you install a revision and that revision is taken out of the current channel: the channel defines what should be installed, and if there’s nothing available there’s nothing to change.


If, identically to what is true currently for firefox, if firefox is installed as latest/stable, but subsequently switched to latest/edge by snap switch --channel=latest/edge firefox, shall it be tracking latest/candidate, which is the newest that is available for firefox (although targeting latest/edge) or shall it merely remain on latest/stable?

Here’s an example command, for the lurkers (replace obsidian with the snap package name of your choice):

sudo snap switch obsidian --channel stable