Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Allowing for replacing the history backing store?
- X-seq: zsh-workers 49167
- From: Jade Fink <zsh@xxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Allowing for replacing the history backing store?
- Date: Fri, 16 Jul 2021 17:40:31 -0700
- Archived-at: <https://zsh.org/workers/49167>
- List-id: <zsh-workers.zsh.org>
Hi!
There's a project I've been thinking about for a long while which is to
make a new shell history system using Postgres, allowing for keeping
better metadata such as working directory among other things with the
history and eliminating the need to use a traditional history file. I
want to implement it as a native-code ZSH module (maintained out of
tree), ideally.
From poking around the zsh codebase briefly, it seems like there is not
really currently a way to do that as the history functions are built
into zsh itself rather than a module.
Before I write a patch, I want to run it past you to see if it's
reasonable and there's not an easier way to do it otherwise.
I was thinking of putting pointers to all the history functions that one
might need to change out to implement a new back end in a structure and
have a pointer to it so you can change it out for your own set (that may
do something else to fulfil the request such as poke a database or
something else), then replace all the functions with indirections, e.g.:
struct histfuncs {
char *(*hgetline)(void);
// ...
}
mod_export struct histfuncs default_histfuncs = {
.hgetline = default_hgetline,
// ...
}
mod_export struct histfuncs *histfuncs = &default_histfuncs;
char *
hgetline(void)
{
return histfuncs->hgetline();
}
If I implemented this approach, would such a patch be taken?
Jade
Messages sorted by:
Reverse Date,
Date,
Thread,
Author