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

Support Editing Priority #449

Open
JP-Ellis opened this issue Jul 9, 2023 · 4 comments
Open

Support Editing Priority #449

JP-Ellis opened this issue Jul 9, 2023 · 4 comments
Labels
s: Client This issue touches the pueue client s: Daemon This issue touches pueue daemon s: Pueue-lib This issue touches the pueue-lib library t: Feature A new feature that needs implementation

Comments

@JP-Ellis
Copy link
Contributor

JP-Ellis commented Jul 9, 2023

A detailed description of the feature you would like to see added.

TL;DR: I would like to be able to edit the priority of a task within the queue.

The recent release of pueue added support for a --priority flag to the pueue add command. It would be great to be able to also edit the priority.

Explain your usecase of the requested feature

For example, if I have recently added an item to the queue but forgot to set it to a high priority, I would be able to execute pueue edit --priority 9 126.

Alternatives

At the moment, the only alternative I can think of is to remove and re-add the task with a higher priority.

Additional context

No response

@Nukesor
Copy link
Owner

Nukesor commented Jul 9, 2023

I already assumed that this request would pop up :D

Yep, this is definitely a missing feature and should also be fairly easy to do :)

@Nukesor Nukesor added t: Feature A new feature that needs implementation s: Pueue-lib This issue touches the pueue-lib library s: Daemon This issue touches pueue daemon s: Client This issue touches the pueue client labels Aug 6, 2023
@Nukesor
Copy link
Owner

Nukesor commented Aug 18, 2023

Here's a thought.
What do you think about making the editing process a bit more accessible and less cumbersome.

I'm currently thinking about exposing all editable properties of a task into temporary well-formatted file (probably YAML, since we're already heavily using this).
One would then just go ahead and call pueue edit $TASK_IDS and a single editor instance would be spawned from which the whole task could be edited in a single view.

@Nukesor
Copy link
Owner

Nukesor commented Aug 18, 2023

On a second thought, this would go hand-in-hand with issues due to YAML's reserved characters and multiline formatting.

I would really like to have a single screen where users can edit all properties of a task, but I'm not sure how this could be achieved without being too hacky...

The current approach via flags just feels a bit clunky. Having multiple editors popping up to edit a single task really isn't convenient at all.

@JP-Ellis
Copy link
Contributor Author

JP-Ellis commented Sep 5, 2023

I think there's merits to both methods.

To have a single screen where users can edit all properties of a task sounds great for situations when I want to interactively edit everything. As to achieving this, I think a method similar to sudoedit might be good. That is, use a temporary file and open up the user's favourite editor to make edits. The temporary file in this case would contain a JSON or YAML representation of the tasks. You would need to handle a bit of logic to validate the input, and decide how much you just want to trust end users or not. I do suspect this might be a bit more involved to implement.

The alternative of using flags lends itself nicely to edit a single property easily, and more automated workflows (e.g., xargs). I do agree that it runs the risk of adding a lot of flags though. Two things I can think of:

  • Be a bit selective as to which flags you want to support. For example, editing the priority seems like a bit of a no-brainer to me. Editing the task itself however seems prone to error and might be better suited to just deleting the task and adding a new one.
  • Hiding a lot of the flags behind an --help-all or similar flag. This way, the help text isn't overloaded with hundreds of flags, but these can still be discovered relatively easily and access very easily.
  • Using a two-argument flag of the form pueue edit X --property foo val1 --property bar val2. This avoids having too many flags, but also provides a lot of flexibility.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
s: Client This issue touches the pueue client s: Daemon This issue touches pueue daemon s: Pueue-lib This issue touches the pueue-lib library t: Feature A new feature that needs implementation
Projects
None yet
Development

No branches or pull requests

2 participants