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:
@@ -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
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user