aboutsummaryrefslogtreecommitdiffstats
path: root/src/lush.c
diff options
context:
space:
mode:
authorGravatar BanceDev 2024-09-04 12:20:50 -0400
committerGravatar BanceDev 2024-09-04 12:20:50 -0400
commit995e8da6536dc25a9ad37e8ef11e9b2f92b48e91 (patch)
treeb2882d3306be8c32723b5b115361f2b92710b5f0 /src/lush.c
parentadded exists function to lua api (diff)
history saving implemented
Diffstat (limited to 'src/lush.c')
-rw-r--r--src/lush.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/lush.c b/src/lush.c
index facdff2..81f9e64 100644
--- a/src/lush.c
+++ b/src/lush.c
@@ -17,6 +17,7 @@ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#include "lush.h"
#include "help.h"
+#include "history.h"
#include "lauxlib.h"
#include "lua.h"
#include "lua_api.h"
@@ -517,6 +518,7 @@ int main() {
// Print the prompt
printf("[%s@%s:%s] ", username, device_name, prompt_cwd);
char *line = lush_read_line();
+ lush_push_history(line);
printf("\n");
if (line == NULL || strlen(line) == 0) {
free(line);
@@ -533,6 +535,7 @@ int main() {
for (int i = 0; args[i]; i++) {
free(args[i]);
}
+ // add last line to history
free(cwd);
free(args);
free(commands);