Nukesor / pueue

:stars: Manage your shell commands.
MIT License
4.93k stars 132 forks source link

Enhance `pueue edit` UX #553

Open pacien opened 2 months ago

pacien commented 2 months ago

Hello, and thank you for this very useful program!

I often forget to pass some options when adding new tasks, and find myself needing to edit those, often in batch.

The current edit sub-command opens an editor for each value to edit, which is quite cumbersome when just wanting to replace a value, especially for multiple tasks at once.

Therefore, I think it would be nice for the edit sub-command to:

Current help text of the edit sub-command:

❯ pueue edit --help
Edit the command, path, label, or priority of a stashed or queued task.
By default only the command is edited.
Multiple properties can be added in one go.

Usage: pueue edit [OPTIONS] <TASK_ID>

Arguments:
  <TASK_ID>  The task's id

Options:
  -c, --command   Edit the task's command
  -p, --path      Edit the task's path
  -l, --label     Edit the task's label
  -o, --priority  Edit the task's priority
  -h, --help      Print help

Target help text with the suggested additions:

❯ pueue edit --help
Edit the command, path, label, or priority of a stashed or queued task(s).
Values specified in options are used as replacements.
When no option is specified, EDITOR is opened.

Usage: pueue edit [OPTIONS] [TASK_IDS]...

Arguments:
  [TASK_IDS]...  The task(s) id

Options:
  -c, --command <COMMAND>    Edit the task(s)' command
  -p, --path <PATH>          Edit the task(s)' path
  -l, --label <LABEL>        Edit the task(s)' label
  -o, --priority <PRIORITY>  Edit the task(s)' priority
  -h, --help                 Print help

When no replacement option is supplied on the CLI, the default EDITOR can be used to edit the properties.

But instead of opening the EDITOR for each value for each task individually, this could be done in a combined way in a single YAML or TOML file.

For example, running pueue edit 0 1 would open an EDITOR with:

[0]
command = "echo this is my first command"
path = "/home/user"
label =
priority = 0

[1]
command = "echo this is my second command"
path = "/home/user/whatever"
label =
priority = 5

Since the current edit sub-command is quite interactive, these modificatinos shouldn't break existing automated user scripts.

Nukesor commented 2 months ago

Thanks for the detailed feature request :)

I already thought about this some time ago, over here.

I would like to take some time to re-evaluate on which approach is the most user-friendly, but this'll have to wait for a bit :)