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

Allow to select task via fuzzyfind (fzf) #437

Closed
thrien opened this issue Jul 9, 2024 · 2 comments
Closed

Allow to select task via fuzzyfind (fzf) #437

thrien opened this issue Jul 9, 2024 · 2 comments

Comments

@thrien
Copy link

thrien commented Jul 9, 2024

Feature Request

Allow to select a task by content instead of linenumber, e.g. via a fuzzyfinder. In all cases where a mandatory task is not provided it is chosen interactively.

Example

I've used fzf as a convenient fuzzyfinder on the commandline to show how this could work:

todo_fzf

If you don't specify a linenumber you get an interactive prompt to select one.

For this simple preview I changed line 1224 to:

    [ "$#" -eq 0 ] && set -- "$(_list "$TODO_FILE" | fzf --height=~10 | awk '{ print $1 }')"

Implementation

I need some guidance by someone more familiar with the code to come up with a proper implementation.

  • What's the cleanest way to get all the tasks/lines with linenumber prefixed but without prompt, etc. ?
  • It probably makes sense to write a function for this.
    • Does it to respect anything else apart from TODO_FILE?
  • Since this feature will add a new dependency it would need to be checked beforehand.
    • Where is the best place to do this?
    • Should there be an option to allow/force/deactivate this feature?
    • How to check if terminal is interactive? (that's something I can probably figure out myself)
@pabgan
Copy link

pabgan commented Jul 12, 2024

You can do it with an alias:

todo.sh do $(todo.sh ls | head -n-2 | fzf --ansi | cut -d' ' -f1)

I think maintainers wants to keep main script as simple as possible.

@thrien
Copy link
Author

thrien commented Jul 12, 2024

Okay, fair enough. Maybe that's a feature for one of the many apps built on top of it.

Then let me just mention for future reference how to use dmenu in this case. With these two patches

it can be nicely integrated as follows

dmenu -w "$WINDOWID" -F -ix -p "Select a task:" < "$TODO_FILE" | xargs expr 1 +

@thrien thrien closed this as not planned Won't fix, can't repro, duplicate, stale Jul 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants