Idea for task-based shell history
06 Mar 2012...now with extra synergy!
No. My idea is that if you cd
into a particular directory, you'd
automagically start a new history file w/in that directory. This
would let you keep history when working on a particular task (which in
turn would assume you have a different directory for each task). This
is sort of related to how I'm beginning to organize work on tickets.
Here's a walkthrough:
- When I start working on a new ticket, I already run something like this:
``` function setup_rt { TICKET=$@ cd ~ mkdir rt_$TICKET cd rt_$TICKET mkdir build test touch notes.org git init git remote add remote remote:/opt/git/rt_${TICKET}.git ssh remote -t "git init --bare /opt/git/rt_${TICKET}.git" } ```
- And now the magic bit, where
cd
ing to that directory automatically saves history in~/rt_$TICKET/.bash_history
.
The magic part is, of course, tricky. I can think of a few ways of accomplishing this:
Automagic directory-specific environment-variable fiddling FTW to set HISTFILE.
A Bash function like:
``` function start_work_on_ticket () { cd ~/rt_$TICKET bash --histfile=~/rt_$TICKET/.bash_history } ```
- Fiddling with history recording to include PWD each time, and then
periodically record by running
grep rt_$TICKET $HISTFILE >> ~/rt_$TICKET/.bash_history
And then of course you'd commit it to git (and birds would sing and did I mention it's sunny outside? Because it is). Even better would be a way for RT to automagically link to git-based repos with all this stuff in them.
Of course, for some/most tickets this is overkill. But there are times when I find myself two weeks into fixing something because it's turned out to be surprisingly involved, and I have no good recollection or record of what's been going on. And it's usually right then that someone comes by and says "Oh hey, turns out we gotta do that all over again because [blah]."
Add a comment:
Name and email required; email is not displayed.
Related Posts
QRP weekend 08 Oct 2018
Open Source Cubesat Workshop 2018 03 Oct 2018
mpd crash? try removing files in /var/lib/mpd/ 11 Aug 2018