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

task by index not working outside of context #44

Closed
naggie opened this issue Sep 14, 2020 · 4 comments
Closed

task by index not working outside of context #44

naggie opened this issue Sep 14, 2020 · 4 comments
Labels
bug Something isn't working

Comments

@naggie
Copy link
Owner

naggie commented Sep 14, 2020

image

The default command, next should ignore the context if a task is referenced to be viewed by ID, much like the edit or note commands which work regardless of context if an ID is provided.

@naggie naggie added the bug Something isn't working label Sep 14, 2020
@naggie
Copy link
Owner Author

naggie commented Oct 7, 2020

@dontlaugh this may be awkward to fix with the current filtering mechanism which sees a combined context and command line filters.

Perhaps the solution is not only ignore the context when an ID is provided, but the rest of the query too. We should probably also throw an error if an ID is specified together with command line filters.

@dontlaugh
Copy link
Contributor

I think you are right. I will try sketching out this solution:

  • if IDs and cmdLine tags or projects are passed, we error. This has the benefit of being catchable immediately after parsing, before a command is even selected
  • of course, context tags will be allowed, since those could be set in the environment.
  • if IDs are passed, we do not need to enter the filtering loop at all, we can take another code path and return early. This will ignore any other attributes in our query, as you describe

@dontlaugh
Copy link
Contributor

dontlaugh commented Oct 7, 2020

Actually, it would be cleaner (and reasonable?) to validate the options passed to NewTaskSet, as well. I will try to do that.


Update: After thinking about this, I think it's simpler to do this validation in func main, for now. The reason is that NewTaskSet does not have a way to differentiate between tags and project strings passed from context vs. command line. And I have a hunch that it would be good to keep those concerns separated. 🤔

dontlaugh added a commit to gloriousfutureio/dstask that referenced this issue Oct 7, 2020
dontlaugh added a commit to gloriousfutureio/dstask that referenced this issue Oct 7, 2020
We extract a function that sets the filtered attribute on tasks if the
task ID matches IDs explicitly passed at the command line. Add a unit
test for this logic.

Refs naggie#44
dontlaugh added a commit to gloriousfutureio/dstask that referenced this issue Oct 7, 2020
We extract a function that sets the filtered attribute on tasks if the
task ID matches IDs explicitly passed at the command line. Add a unit
test for this logic.

Refs naggie#44
dontlaugh added a commit to gloriousfutureio/dstask that referenced this issue Oct 18, 2020
We extract a function that sets the filtered attribute on tasks if the
task ID matches IDs explicitly passed at the command line. Add a unit
test for this logic.

Return an error if IDs are passed in combination with other attributes

Refs naggie#44
dontlaugh added a commit to gloriousfutureio/dstask that referenced this issue Oct 18, 2020
We extract a function that sets the filtered attribute on tasks if the
task ID matches IDs explicitly passed at the command line. Add a unit
test for this logic.

Return an error if IDs are passed in combination with other attributes

Refs naggie#44
@naggie
Copy link
Owner Author

naggie commented Oct 20, 2020

thanks to @dontlaugh -- fixed by #62

@naggie naggie closed this as completed Oct 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants