1
0
mirror of https://github.com/janet-lang/janet synced 2026-05-19 20:02:15 +00:00

Disable persistent REPL history without JANET_HISTFILE.

This commit is contained in:
Calvin Rose
2026-01-22 17:58:18 -06:00
parent 0c402cf3d6
commit 53b8bf2684
2 changed files with 4 additions and 15 deletions
+3 -2
View File
@@ -156,7 +156,7 @@ Shows the version text and exits immediately.
.TP
.BR \-s
Read raw input from stdin and forgo prompt history and other readline-like features.
Read raw input from stdin and forgo fancy input, which includes prompt history and other readline-like features.
.TP
.BR \-e\ code
@@ -274,7 +274,8 @@ cannot be defined for this variable to have an effect.
.B JANET_HISTFILE
.RS
A file location to use for the default shell's REPL history. This relative path is where commands are persisted between sessions.
A file location to use for the default shell's REPL history when using fancy input. This relative path is where commands are persisted between sessions.
If unset, no repl history well be used. Does not work with the -s flag where fancy input is disabled.
.RE
.B NO_COLOR
+1 -13
View File
@@ -437,20 +437,8 @@ static void calc_history_file(void) {
if (hist) {
gbl_history_file = sdup(hist);
} else {
const char *home = (const char *) getenv("HOME");
if (NULL == home) home = "";
const char *filename = ".janet_history.jdn";
size_t homelen = strlen(home);
size_t filelen = strlen(filename);
size_t buflen = homelen + filelen + 1;
char *buffer = janet_malloc(buflen + 1);
if (homelen) memcpy(buffer, home, homelen);
buffer[homelen] = '/';
memcpy(buffer + homelen + 1, filename, filelen);
buffer[buflen] = '\0';
gbl_history_file = buffer;
gbl_history_file = NULL;
}
/* fprintf(stderr, "history_file: %s\n", gbl_history_file); */
}
static void loadhistory(void) {