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

cobra #9

Merged
merged 62 commits into from
Nov 16, 2021
Merged

cobra #9

merged 62 commits into from
Nov 16, 2021

Conversation

kkga
Copy link
Owner

@kkga kkga commented Oct 11, 2021

  • minor: update envrc
  • add filter interface
  • minor: update testdata
  • update item
  • use new filter types in list
  • todo
  • move filter and sort types into single file
  • add exclude tag filter
  • use lowercase for tag parsing
  • simplify tag filters
  • start migrating to cobra

@WhyNotHugo
Copy link
Contributor

I've to say, I'm following this with lots of interest.

I'd been thinking of rewriting todoman in either golang or rust. When I saw your initial release, my doubts about performance were cleared. I did start writing todoman-in-go, but honestly, I've only like 100 lines of code that don't do anything yet.

I'm very curious where this is going, since maintaining re-distributable apps like todoman in python is become a pain.

I've a hint that might be useful further down the line: todoman (since its early verions) stored a map of filename->id whenever it re-scanned files. This is so that subsequent runs keep ids consistent (e.g.: if I run todoman list, and todoman new, I can be sure ids haven't changed unexpectedly).

This stored file also kept a list of "files that are not todos", to skip parsing them in subsequent runs, which also speeds up even a bit more. (nowadays it also does a lot more caching to compensate for slowness in python, but I don't think that's needed in go due do its fastness).

Oh, and I really recommend looking at viper for configuration; it handles both environment variables and config files very cleanly for you 😌

@kkga
Copy link
Owner Author

kkga commented Oct 24, 2021

Hey Hugo! Thanks for your interest!

I'm very curious where this is going, since maintaining re-distributable apps like todoman in python is become a pain.

I will continue working on the program, since I use it daily.
As for this PR specifically, there's still a bit of work required to refactor for cobra. I initially decided to not use any libs for the CLI and try to implement it from scratch, since it's basically my second Go program. Now that I have a better understanding of what libs like cobra provide, I'm better equipped to integrate it and it should result in a better CLI experience.

I've a hint that might be useful further down the line: todoman (since its early verions) stored a map of filename->id whenever it re-scanned files. This is so that subsequent runs keep ids consistent (e.g.: if I run todoman list, and todoman new, I can be sure ids haven't changed unexpectedly).

Thanks for the tip, I thought about doing something like this actually to make sure that IDs don't change. Shouldn't be too hard.

Oh, and I really recommend looking at viper for configuration; it handles both environment variables and config files very cleanly for you

Thanks, will take a look. I do like the simplicity of using env variables for configuration, but wouldn't hurt to have both I think.

@kkga
Copy link
Owner Author

kkga commented Nov 16, 2021

This looks to be good for merging, since all commands are now ported to cobra.

I'm gonna tackle the persistent IDs issue in a separate PR.

@kkga kkga merged commit 482cc2d into main Nov 16, 2021
@kkga kkga deleted the cobra branch November 16, 2021 22:15
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.

None yet

2 participants