Fossil SCM

fossil shell prompt now contains project name, if any, per request in [https://fossil-scm.org/forum/forumpost/c0a0123fb8|forumpost/c0a0123fb8].

stephan 2020-04-03 09:41 trunk
Commit ce6eaf0fb0444a9b3139054dacd9fca033b6bce3d6632ae6d1ad78e32e0b147c
1 file changed +4 -1
+4 -1
--- src/fshell.c
+++ src/fshell.c
@@ -57,16 +57,18 @@
5757
int n, i;
5858
char **azArg = 0;
5959
int fDebug;
6060
pid_t childPid;
6161
char *zLine = 0;
62
+ char *zPrompt = 0;
6263
fDebug = find_option("debug", 0, 0)!=0;
6364
db_find_and_open_repository(OPEN_ANY_SCHEMA|OPEN_OK_NOT_FOUND, 0);
65
+ zPrompt = mprintf("fossil (%z)> ", db_get("project-name","no repo"));
6466
db_close(0);
6567
sqlite3_shutdown();
6668
linenoiseSetMultiLine(1);
67
- while( (free(zLine), zLine = linenoise("fossil> ")) ){
69
+ while( (free(zLine), zLine = linenoise(zPrompt)) ){
6870
/* Remember shell history within the current session */
6971
linenoiseHistoryAdd(zLine);
7072
7173
/* Parse the line of input */
7274
n = (int)strlen(zLine);
@@ -117,7 +119,8 @@
117119
/* The parent process */
118120
int status;
119121
waitpid(childPid, &status, 0);
120122
}
121123
}
124
+ free(zPrompt);
122125
#endif
123126
}
124127
--- src/fshell.c
+++ src/fshell.c
@@ -57,16 +57,18 @@
57 int n, i;
58 char **azArg = 0;
59 int fDebug;
60 pid_t childPid;
61 char *zLine = 0;
 
62 fDebug = find_option("debug", 0, 0)!=0;
63 db_find_and_open_repository(OPEN_ANY_SCHEMA|OPEN_OK_NOT_FOUND, 0);
 
64 db_close(0);
65 sqlite3_shutdown();
66 linenoiseSetMultiLine(1);
67 while( (free(zLine), zLine = linenoise("fossil> ")) ){
68 /* Remember shell history within the current session */
69 linenoiseHistoryAdd(zLine);
70
71 /* Parse the line of input */
72 n = (int)strlen(zLine);
@@ -117,7 +119,8 @@
117 /* The parent process */
118 int status;
119 waitpid(childPid, &status, 0);
120 }
121 }
 
122 #endif
123 }
124
--- src/fshell.c
+++ src/fshell.c
@@ -57,16 +57,18 @@
57 int n, i;
58 char **azArg = 0;
59 int fDebug;
60 pid_t childPid;
61 char *zLine = 0;
62 char *zPrompt = 0;
63 fDebug = find_option("debug", 0, 0)!=0;
64 db_find_and_open_repository(OPEN_ANY_SCHEMA|OPEN_OK_NOT_FOUND, 0);
65 zPrompt = mprintf("fossil (%z)> ", db_get("project-name","no repo"));
66 db_close(0);
67 sqlite3_shutdown();
68 linenoiseSetMultiLine(1);
69 while( (free(zLine), zLine = linenoise(zPrompt)) ){
70 /* Remember shell history within the current session */
71 linenoiseHistoryAdd(zLine);
72
73 /* Parse the line of input */
74 n = (int)strlen(zLine);
@@ -117,7 +119,8 @@
119 /* The parent process */
120 int status;
121 waitpid(childPid, &status, 0);
122 }
123 }
124 free(zPrompt);
125 #endif
126 }
127

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button