100 Days of Code: Day 15

After a busy weekend of visiting siblings, car troubles (snow’s no joke) and getting back to school, I had a chance to sit down to work on my #100DaysOfCode project.

I saw the Geometry zsh theme hit 2.0! It looks like a more modular Pure, which is fantastic for me!

With that, I figured it was as good of a time as ever to rename and rebrand my prompt segment to be more prompt-agnostic. I now have instructions for enabling it with Geometry, P10k, and Bullet Train.

The project is now moved to zsh-prompt-dir-glob

100 Days of Code: Day 13

Wrote more of the zparseopts post, I think I have everything explained. Waiting until I look over it more tomorrow, see if I worded anything poorly.

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 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 07

zsh: segmentation fault (core dumped)  build/waybar
zsh: segmentation fault (core dumped)  build/waybar
zsh: segmentation fault (core dumped)  build/waybar
zsh: segmentation fault (core dumped)  build/waybar
zsh: segmentation fault (core dumped)  build/waybar
zsh: segmentation fault (core dumped)  build/waybar
zsh: segmentation fault (core dumped)  build/waybar

I know what breaks it, but I don’t know why.

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.