-
Notifications
You must be signed in to change notification settings - Fork 138
Description
A detailed description of the feature you would like to see added.
I would like to have a simple --follow
flag to add
. Running pueue add --folow <CMD>
should act just like:
pueue add <CMD>
pueue follow <TASK_ID_FROM_ADD>
Basically, it adds the task and follows its output. Just like the separate commands, Ctrl+C during a pueue add --folow
should stop following but continue running the task.
I am not quite sure what the behaviour should be if the task cannot be immediately started. Running separate add/follow will just block while waiting for the command to start. Maybe it should print a warning then continue waiting.
Explain your usecase of the requested feature
This will help get instant feedback when there is an initialisation problem for long-running tasks. A lot of the time, I run pueue add
but make simple mistakes in the command (e.g. typo, wrong working directory). The mistakes cause the task to fail immediately but this is not immediately visible.
At the moment, I have to remember to pueue status
after every add
to make sure that the command is running properly. It's easy to forget this step, go away, and come back to an error instead of the the results I waited for.
Alternatives
One could make an alias, however this makes it harder to add more options to add
. I guess this bash would work:
pueue-add-follow() {
task=$(pueue add --print-task-id "$@")
sleep 1 # XXX: race condition! hopefully, if it is not queued, it will start after one second.
pueue --color=always status | grep '^\s*'"$task"' ' # XXX: hack: status query does not support filtering by ID
pueue follow $task
}
but it's a little janky.
The comments show how difficult it is to mimic the behaviour, especially if we want user-friendly information about whether the new task is running or in a queue.
Myself, I just try to remember pueue status
after every pueue add
.
Additional context
Thank you for the well-made project! :)