Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: support opam switch - #4688

Closed
craigfe opened this issue May 30, 2021 · 1 comment · Fixed by #4910
Closed

Feature request: support opam switch - #4688

craigfe opened this issue May 30, 2021 · 1 comment · Fixed by #4910

Comments

@craigfe
Copy link

craigfe commented May 30, 2021

In interacting with Opam switches, I quite often find myself wanting to switch to a particular switch in order to perform a specific thing, then switch back to the switch I was on before:

$ opam switch plugin-host
$ ...                     # rebuild an opam plugin
$ opam switch irmin+4.10  # resume normal operation

The Git CLI has an idiom for this w.r.t branches, allowing git switch -:

$ git switch plugin-host
$ ...
$ git switch -             # go back to branch before `plugin-host`

(In fact, Git has a more general @{-N} syntax for referencing historic branch states, and - is a synonym of @{-1}.)

It might be nice if the opam CLI could support a similar syntax, although this would likely be a breaking change as it's currently possible to name an Opam switch "-".

@AltGr
Copy link
Member

AltGr commented Jun 10, 2021

Indeed that could be convenient, it just means we would need to store a list of previously selected switches in the config.

For now, and for simple commands I'd just use --switch plugin-host for the intermediate commands :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants