Wrote most of a zparseopts post, I’ll be putting it up here soon.
100 Days of Code: Day 11
I re-wrote the cache-clearing function,
adding options with zparseopts.
I really think I need to write a post about it…
Tell you what, that will be tomorrow’s project.
Just a post about zparseopts.
It’s such a good tool, and people need to know about it!
100 Days of Code: Day 10
Ladies and gentlemen, we have README.
Today was documentation day, and I now have a better screenshot (on the README). I am still unsure where to go from here. I may ask feedback from other established zsh project devs, just in case.
100 Days of Code: Day 09
Today was a day of cleanup.
I got a few GitHub notifications on projects I worked on in the past. There was a new mako release, which I am happy to be a small part of. I do need to fix something that slipped my mind, which I’m kinda embarrassed about.
Additionally, I got an issue in on my vi-increment plugin, which I promptly fixed and pushed a point-release of. This actually was really good news; this is confirmation that other people actually use the stuff I write!
I need to change some process, I have a tendency to break stuff when renaming.
100 Days of Code: Day 08
So a bad cold and a busy day made me take off Thursday.
“Today” (yesterday as I write this) I went ahead and added caching for truncation, as well as refactored the prompt function into its own file, and re-merged the code from the helper functions into the main function.
Not a terribly productive day, but I’m running out of useful changes. I may dedicate a day or two to README/wiki writing; never underestimate how important good docs are.
100 Days of Code: Day 06
The way I implemented caching was flawed. I cached the entire formatted directory, for example:
# this is: -t c6 --pre '%F{magenta}'
__prompt_dir_glob__cache[/tmp/something]='%F{magenta}somet\u2025'
This will break if the user wants the last directory to always be not-truncated.
So, we now cache only the glob that matches, and check prefix/suffix/truncate every time.
The second thing I did was to split ::add_glob out to its own file,
and add a --help for it.
Finally, I also renamed things to use underscores.
While I prefer hyphens in functions,
the P10K API requires segments to be called prompt_$name.
To prevent confusion, I just renamed everything.
I may revert this in the future, though.
100 Days of Code: Day 05
Things are in place enough that I can make the demo more interesting. The demo now shows three use cases:
/some/pathwith the default separator (causing all/to be colored as the previous dir)./some/pathwith a colored separator./ 〉some 〉path(but using nerd-fonts powerline symbols) with a seperated root.
(Ignore my bad cropping job pls)
The demo, of course, turned up some more bugs, so I took care of those too. I came up with an idea for next time, so I wrote a TODO as well.
I’m pretty confident 3 or 4 more days on this will do it.
100 Days of Code: Day 04
After some discussion on the issue,
it was decided
that the WidnowId class isn’t consistently defined as signed or unsigned.
So, by not specifying either,
we can adapt if projects do eventually agree.
Neat.
Anyway, not much happening today due to a family event.
The most code I wrote today was
in response to a Reddit post,
where I showed someone how zparseopts works.
Here’s a link to the demo code on TIO.
I think I want to make a more comprehensive post on zparseopts,
maybe write a compatible Bash function to do the same thing.
(Or maybe I should stop taking on new projects.)
That said, I also fixed a bug in p10k-dir-glob.
100 Days of Code: Day 03
More writing my custom powerlevel10k segment.
It’s to a point where I have it in my $ZDOTDIR/.zshrc.
I split the main logic into its own autoloaded function file,
since I expect most users to have cache misses on 90% of their sessions.
Now that I’m using it daily,
I’ll probably get distracted by whatever paper cuts still remain in the project.
I also made an error? miscalculation? in a contribution to waybar. I’m curious what is wrong, because I made what looks like a fix to me, but not to the owner. They are almost certainly right, but I’m hoping to learn why.
100 Days of Code: Day 02
Today was more work on p10k-dir-glob. I got a reply from romaktv, and I ended up implementing caching myself.
I also reworked how the initial-dir case was handled, and fixed some bugs.