this post was submitted on 18 Jul 2024
269 points (98.6% liked)
Programmer Humor
19589 readers
622 users here now
Welcome to Programmer Humor!
This is a place where you can post jokes, memes, humor, etc. related to programming!
For sharing awful code theres also Programming Horror.
Rules
- Keep content in english
- No advertisements
- Posts must be related to programming or programmer topics
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
All of the repos for my GitHub sourced vim plugins live under one parent directory. I symlink to them from ~/.vim
One example is a simple function that pushes the top level repo directory onto my dir stack and then runs a loop where it pushes each subdir into the stack, runs "ggpull" then pops back to the top level repo directory. ggpull is an alias added by the zsh git plugin. After all repos have been updated it pops back to my original pwd.
I run this as part of my "update all the things" script but sometimes I also want to run it in demand from the cli. So I want this function in all scopes and I want it to have access to "ggpull" in all of those scopes.
I also "misuse" timewarrior a bit and use it to time things like "how much time do I spend waiting for salt to run". That has its own timewarrior db and a wrapper function for pointing the command at said db. I use this in both login and non login shell contexts.
Yeah, I'd write this as a single
update
script with options toupdate vimplugins
orupdate pkg
orupdate all
.I see that you want it to be a function so you can get the chdir as a side effect, but mixing that with updating doesn't make sense to me.