Skip to content

Conversation

@AgumasD
Copy link
Contributor

@AgumasD AgumasD commented Dec 27, 2024

###Pull Request Description:
This pull request introduces a new search command to the todo.txt-cli, designed to simplify the task filtering process.

###Problem:
The existing list command is versatile but can be complex for users when filtering tasks using multiple terms or regex. This complexity can deter new users from effectively using the CLI.

###Solution:
Introduced a new search command to make task filtering simple and intuitive.
The search command allows users to find tasks by specifying keywords directly, without requiring complex syntax.
###Example usage:
todo.sh search "keyword"
This displays all tasks containing the specified keyword(s).
Changes Made:
todo.sh:

Added a search action in the command handler.
Implemented filtering logic using grep to find matching tasks from todo.txt.
###Test Cases:
Created a new file test/search.test with test cases to ensure the functionality works correctly.
Verified edge cases such as no matches or invalid input.
###Documentation:

Updated README.md to include usage examples for the new search command.
###Example Output:
Input:
todo.sh search "meeting"
Output:
3 (A) Prepare for team meeting +work @office
7 Follow up after client meeting +work @email
###Impact:
Simplifies task filtering for users, especially beginners.
Improves the overall user experience and aligns with the goal of simplifying task management.

###Fixes #445

Copy link
Member

@inkarkat inkarkat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • 595fdea has already been merged; please rebase on top of it
  • This PR also (accidentally?) includes the proposed (in #449) new renameproj action
  • New actions need to be covered by automated tests; the checklist in the PR template (that you've deleted!) asks for those.

I don't want to curb your enthusiasm, but this is a mature (and slow-moving) project. By first opening issues with your suggestions, you did the right thing; I'd recommend to first wait for (positive) feedback before proceeding with implementations.

"search")
shift
if [ -z "$1" ]; then
die "usage: $TODO_SH search [KEYWORD...]"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Searching without any KEYWORD doesn't make sense, and the usage contradicts the check above.

if [ -z "$1" ]; then
die "usage: $TODO_SH search [KEYWORD...]"
fi
grep -i "$@" "$TODO_FILE"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unlike list, this doesn't do any numbering, formatting, and highlighting; this is just a plain grep?!

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

Successfully merging this pull request may close these issues.

Add Detailed Examples to the "Usage" Section in README.md

2 participants