Skip to content

Conversation

dontlaugh
Copy link
Contributor

If this env var is set to a valid context string, it takes precedence
over context stored in local state. The "--" ignore context token will
still be respected, however.

Refs #20

@dontlaugh dontlaugh mentioned this pull request Oct 31, 2020
If this env var is set to a valid context string, it takes precedence
over context stored in local state. The "--" ignore context token will
still be respected, however.

Space-separated strings are allowed in DSTASK_CONTEXT. We tokenize
before passing to ParseCmdLine

Refs naggie#20
@dontlaugh dontlaugh force-pushed the 20_multiple_active_context branch from 2c68b4b to c962b4e Compare October 31, 2020 16:55
@dontlaugh dontlaugh marked this pull request as ready for review October 31, 2020 16:56
@dontlaugh
Copy link
Contributor Author

@naggie I opted for a shorter env var name. Let me know if there's another you'd prefer.

@naggie
Copy link
Owner

naggie commented Nov 1, 2020

Just a few thoughts:

  • Could mention the use cases in an advanced section of the readme (eg, direnv for automatic setting of project: inside a git repository)
  • I think we should warn/notify the user (yellow) when the env var is being used (I;m just a bit wary of this causing a bit of confusion or accidental tags etc)
  • Attempting to set a context when the env var is set should result in an error

I think I might set my bash/zsh prompt to display the current dstask context like it shows the git branch.

@dontlaugh
Copy link
Contributor Author

dontlaugh commented Nov 1, 2020

How about this message?

image
This is one way to do it. The message can be shimmed in here, otherwise it will be empty string if DSTASK_CONTEXT is not set 5b9239c

Come through and adjust the message style any way you like. Perhaps this is a little wordy.

We describe how to use them, and how to set them with the command and
with DSTASK_CONTEXT
@dontlaugh
Copy link
Contributor Author

dontlaugh commented Nov 1, 2020

Here is an implementation of the error case you described

image

Update: amended this slightly to allow printing the context, e.g. calling dstask context with no further arguments. Modifying the context while DSTASK_CONTEXT is set will be disallowed.

@dontlaugh
Copy link
Contributor Author

For the documentation bit, I opted for a whole section just about Context.

@naggie
Copy link
Owner

naggie commented Nov 5, 2020

Thanks @dontlaugh looks top notch.

@naggie naggie merged commit d7b41dd into naggie:master Nov 5, 2020
@dontlaugh dontlaugh deleted the 20_multiple_active_context branch November 5, 2020 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants