justinmayer / virtualfish

Fish shell tool for managing Python virtual environments

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Global site packages: add query and force-set options

airwoodix opened this issue · comments

  • I have searched the issues (including closed ones) and believe that this is not a duplicate.
  • I have searched the documentation and believe that my question is not covered.
  • I am willing to lend a hand to help implement this feature.

Feature Request

While working on #173, my main problem with vf globalpackages came up again: toggling is really not the most ergonomic interface to this setting. Usually, I know what I want to do: enabling or disabling global site packages.

The current (toggling) behavior is compatible with virtualenvwrapper and should therefore remain the default. What about extra options for query and force-set?

  • vf globalpackages -s|--status: query status -> true|false
  • vf globalpackages true|false: set status explicitly

For the query, -q is not an option since it should be reserved for --quiet (could be added on the same occasion, see virtualenvwrapper).

Alternatively, dropping the virtualenvwrapper compatibility, vf globalpackages could display the status and vf globalpackages toggle would toggle the setting.

Comments most welcome!

My initial thought is that we could leave the current bare vf globalpackages behavior as-is and add vf globalpackages on & vf globalpackages off sub-commands.

I'm not sure I understand the benefit of querying the status. Presumably the idea is to make sure the state is set on or off as desired in that moment, at which point it would probably make more sense to just set it on or off (even if it's already in that state).

Thanks for the feedback.

My initial thought is that we could leave the current bare vf globalpackages behavior as-is and add vf globalpackages on & vf globalpackages off sub-commands.

Yes, that works as well. My main problem with the current behavior is that "toggle" is really not what I would expect from this command if knowing nothing about it. But backwards compatibility should be maintained.

I'm not sure I understand the benefit of querying the status. Presumably the idea is to make sure the state is set on or off as desired in that moment, at which point it would probably make more sense to just set it on or off (even if it's already in that state).

Indeed. The operation is really inexpensive so just forcing the state is simple enough. Querying is what I would expect from the current command since it has no verb/action but this as probably no real use case.

I can work on this once #173 is merged.

Hi Etienne. Since your previous PR has been merged, so you want to submit a PR for the other functionality discussed here?

Hi Etienne. Once you are ready to work on querying the status (as discussed above), let me know so we can re-open this issue. Cheers! 👋

Sorry for the very long delay. I finally prepared a PR for this feature #193. Thanks for your patience @justinmayer!