Interactive CLI choosing mode (interactive task listing with filtering) #641
-
Hi, It would be really nice to be able to run taskfile in an interactive CLI choice mode. i.e. A setting for "default" task to show the list of tasks, and using the cursor keys you get to choose and drill down until you find the one you are looking for. so i.e Show all tasks and drill down into subtasks etc
OR if I have a list of subtasks under the "exporter" taskfile then running
would display all tasks for "exporter:" (a.k.a filtering) and allow choosing with the cursor keys or drilling down more i.e.
exporter is actually a subtask i.e.
Here is an example in the javascript ecosystem. https://www.npmjs.com/package/ntl , there are many others. I thought it would be a nice addition. Great product, by the way, I have dropped makefiles and use this now - everywhere :-) |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 1 reply
-
Hello @iangregsondev! You could achieve something like this using fzf:
It needs a bit more work to get it properly working inside taskfile itself however. EDIT: Here's a full example that works defined within taskfile itself: version: '3'
vars:
GREETING: Hello, World!
tasks:
hello:
desc: "say hello"
cmds:
- echo "{{.GREETING}}"
silent: true
default:
cmds:
- |
selected=$(task -l | grep -v "task: Available" | fzf --prompt="task:")
echo "$selected" | awk '{sub(/:$/, "", $2); print $2}' | xargs task
silent: true |
Beta Was this translation helpful? Give feedback.
-
Wow, i like it... There is one small issue though. It removes the colon (:) from the wrong place i.e.
But I like it, that's pretty cool. |
Beta Was this translation helpful? Give feedback.
-
corrected the regexp in awk: |
Beta Was this translation helpful? Give feedback.
-
here is my version with gum:
|
Beta Was this translation helpful? Give feedback.
Hello @iangregsondev! You could achieve something like this using fzf:
It needs a bit more work to get it properly working inside taskfile itself however.
EDIT: Here's a full example that works defined within taskfile itself: