Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Remove the "fossil usage" and "fossil options" command. Use instead the the --usage/-u or --options/-o options on the "fossil help" command. Other improvements and fixes to the recent "fossil help" enhancement. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
b097e6899e6dc0c97dce181dec2e4093 |
| User & Date: | drh 2025-03-01 20:31:20.147 |
Context
|
2025-03-02
| ||
| 18:57 | Remove an extraneous call of find_server_repository() in win32 implementation of server/ui, added by [0a473cd5533f5bb2]. The extra call to find_server_repository() unnecessary lock which prevent "fossil close" from deleting the checkout db while a server instance is running. (reported in forum post: [forum:e7f3472c46eae4bd]) ... (check-in: 28436ab9d5 user: mgagnon tags: trunk) | |
|
2025-03-01
| ||
| 20:31 | Remove the "fossil usage" and "fossil options" command. Use instead the the --usage/-u or --options/-o options on the "fossil help" command. Other improvements and fixes to the recent "fossil help" enhancement. ... (check-in: b097e6899e user: drh tags: trunk) | |
| 16:02 | Improvements to rendering in the "fossil help" command, especially in combination with the -u/--usage and -o/--options command-line options. ... (check-in: 62cb8ea785 user: drh tags: trunk) | |
Changes
Changes to src/dispatch.c.
| ︙ | ︙ | |||
524 525 526 527 528 529 530 |
/*
** Format help text for TTY display.
*/
static void help_to_text(const char *zHelp, Blob *pText, int bUsage){
int i, x;
char c;
| > | | > > > | 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 |
/*
** Format help text for TTY display.
*/
static void help_to_text(const char *zHelp, Blob *pText, int bUsage){
int i, x;
char c;
if( zHelp[0]=='>' ){
if( !bUsage ){
blob_appendf(pText, "Usage:");
}else{
blob_append_char(pText, ' ');
}
zHelp++;
}
for(i=0; (c = zHelp[i])!=0; i++){
if( c=='%' && strncmp(zHelp+i,"%fossil",7)==0 ){
if( i>0 ) blob_append(pText, zHelp, i);
blob_append(pText, "fossil", 6);
zHelp += i+7;
|
| ︙ | ︙ | |||
1064 1065 1066 1067 1068 1069 1070 | } @ </dl> blob_reset(&buf); style_finish_page(); } /* | > > | > > > | | < | | > > > | | > | < | | | 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 |
}
@ </dl>
blob_reset(&buf);
style_finish_page();
}
/*
** Analyze p and return one of three values:
**
** 0 p is the continuation of a prior subcommand.
**
** 1 p is text past the end of a prior subcommand.
**
** 2 p is the start of a new subcommand.
*/
static int is_subcommand(Blob *p, int bAbbrevSubcmd){
int i, sz;
const unsigned char *z = (const unsigned char*)blob_buffer(p);
sz = blob_size(p);
if( sz>6 ) sz = 6;
for(i=0; i<sz && fossil_isspace(z[i]); i++){}
if( i>=sz ) return 0;
if( bAbbrevSubcmd==0 ){
if( i>1 ) return 0;
return z[0]=='>' ? 2 : 1;
}else{
return (i==3 && fossil_isalpha(z[3])) ? 2 : 1;
}
}
/*
** Input z[] is help text for zTopic. If zTopic has sub-command zSub,
** then cut out all portions of the original help text that do not
** directly pertain to zSub and write the zSub-relevant parts into
|
| ︙ | ︙ | |||
1107 1108 1109 1110 1111 1112 1113 |
char *zQSub = re_quote(zSubtopic);
char *zPattern;
ReCompiled *pRe = 0;
if( bAbbrevSubcmd ){
zPattern = mprintf(" ([a-z]+ ?\\| ?)*%s\\b", zQSub);
}else{
| | | > | > > > > > | | > | | > > | > | > > > > > > > | 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 |
char *zQSub = re_quote(zSubtopic);
char *zPattern;
ReCompiled *pRe = 0;
if( bAbbrevSubcmd ){
zPattern = mprintf(" ([a-z]+ ?\\| ?)*%s\\b", zQSub);
}else{
zPattern = mprintf("> ?fossil [-a-z]+ .*\\b%s\\b", zQSub);
}
fossil_free(zQTop);
fossil_free(zQSub);
re_compile(&pRe, zPattern, 0);
fossil_free(zPattern);
blob_init(&in, z, -1);
while( blob_line(&in, &line) ){
if( re_match(pRe, (unsigned char*)blob_buffer(&line), blob_size(&line)) ){
int atStart = 1;
blob_appendb(pOut, &line);
n++;
while( blob_line(&in, &line) ){
if( re_match(pRe,(unsigned char*)blob_buffer(&line),blob_size(&line)) ){
blob_appendb(pOut, &line);
n++;
atStart = 1;
}else{
int x = is_subcommand(&line,bAbbrevSubcmd);
if( x==2 ){
if( atStart ){
blob_appendb(pOut, &line);
n++;
}else{
break;
}
}else if( x==1 ){
break;
}else{
blob_appendb(pOut, &line);
n++;
atStart = 0;
}
}
}
}
}
blob_reset(&line);
re_free(pRe);
if( n ){
blob_trim(pOut);
blob_reset(&in);
|
| ︙ | ︙ | |||
1238 1239 1240 1241 1242 1243 1244 |
blob_reset(&subsection);
}
blob_appendb(pOut, &line);
}else if( len>7 && !fossil_isspace(zLine[0]) && bSubsectionSeen
&& sqlite3_strlike("%options:%",blob_str(&line),0)==0 ){
subsection = line;
}else if( !bAbbrevSubcmd && len>9
| | > | 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 |
blob_reset(&subsection);
}
blob_appendb(pOut, &line);
}else if( len>7 && !fossil_isspace(zLine[0]) && bSubsectionSeen
&& sqlite3_strlike("%options:%",blob_str(&line),0)==0 ){
subsection = line;
}else if( !bAbbrevSubcmd && len>9
&& (memcmp(zLine,"> fossil ",9)==0
|| memcmp(zLine,"> fossil",9)==0) ){
subsection = line;
bSubsectionSeen = 1;
}else if( bAbbrevSubcmd && len>5 && memcmp(zLine," ",3)==0
&& fossil_isalpha(zLine[3]) ){
subsection = line;
bSubsectionSeen = 1;
}else if( len>1 && !fossil_isspace(zLine[0]) && bSubsectionSeen ){
|
| ︙ | ︙ | |||
1345 1346 1347 1348 1349 1350 1351 | @ --ssl-identity NAME Set the SSL identity to NAME @ --systemtrace Trace calls to system() @ -U|--user USER Make the default user be USER @ --utc Display times using UTC @ --vfs NAME Cause SQLite to use the NAME VFS ; | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 | @ --ssl-identity NAME Set the SSL identity to NAME @ --systemtrace Trace calls to system() @ -U|--user USER Make the default user be USER @ --utc Display times using UTC @ --vfs NAME Cause SQLite to use the NAME VFS ; /* ** COMMAND: help ** ** Usage: %fossil help [OPTIONS] [TOPIC] [SUBCOMMAND] ** ** Display information on how to use TOPIC, which may be a command, webpage, or ** setting. Webpage names begin with "/". If TOPIC is omitted, a list of |
| ︙ | ︙ | |||
1589 1590 1591 1592 1593 1594 1595 |
return;
}
z = g.argv[0];
fossil_print(
"Usage: %s help TOPIC\n"
"Things to try:\n\n"
" %s help help\n"
| | | 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 |
return;
}
z = g.argv[0];
fossil_print(
"Usage: %s help TOPIC\n"
"Things to try:\n\n"
" %s help help\n"
" %s help -o\n"
" %s help -a\n"
" %s search -h TOPIC\n\n"
"Other common values for TOPIC:\n\n",
z, z, z, z, z);
command_list(CMDFLAG_1ST_TIER,verboseFlag,useHtml);
if( !verboseFlag ) version_cmd();
return;
|
| ︙ | ︙ | |||
1645 1646 1647 1648 1649 1650 1651 |
blob_init(&subtext1, 0, 0);
blob_init(&subtext2, 0, 0);
blob_init(&s3, 0, 0);
if( zSubtopic!=0 ){
if( simplify_to_subtopic(z, &subtext1, zTopic, zSubtopic, bAbbrevSubcmd) ){
z = blob_str(&subtext1);
}else{
| | < | < > | 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 |
blob_init(&subtext1, 0, 0);
blob_init(&subtext2, 0, 0);
blob_init(&s3, 0, 0);
if( zSubtopic!=0 ){
if( simplify_to_subtopic(z, &subtext1, zTopic, zSubtopic, bAbbrevSubcmd) ){
z = blob_str(&subtext1);
}else{
fossil_print("No subtopic \"%s\" for \"%s\".\n", zSubtopic, zTopic);
bUsage = 1;
zSubtopic = 0;
}
}
if( bUsage ){
if( simplify_to_usage(z, &subtext2, zTopic, bAbbrevSubcmd) ){
z = blob_str(&subtext2);
}else{
bUsage = 0;
|
| ︙ | ︙ | |||
1680 1681 1682 1683 1684 1685 1686 |
}
blob_init(&txt, 0, 0);
if( bRaw ){
blob_append(&txt, z, -1);
}else if( useHtml ){
help_to_html(z, &txt);
}else{
| | | 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 |
}
blob_init(&txt, 0, 0);
if( bRaw ){
blob_append(&txt, z, -1);
}else if( useHtml ){
help_to_html(z, &txt);
}else{
help_to_text(z, &txt, bUsage || zSubtopic!=0);
}
if( blob_strlen(&txt)>0 ) fossil_print("%s\n", blob_str(&txt));
blob_reset(&txt);
blob_reset(&subtext1);
blob_reset(&subtext2);
}
|
| ︙ | ︙ |
Changes to src/export.c.
| ︙ | ︙ | |||
478 479 480 481 482 483 484 485 486 487 488 489 490 491 |
** --rename-trunk NAME Use NAME as name of exported trunk branch
** -R|--repository REPO Export the given REPOSITORY
**
** See also: import
*/
/*
** COMMAND: export*
**
** This command is deprecated. Use "fossil git export" instead.
*/
void export_cmd(void){
Stmt q, q2, q3;
Bag blobs, vers;
unsigned int unused_mark = 1;
| > > | 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 |
** --rename-trunk NAME Use NAME as name of exported trunk branch
** -R|--repository REPO Export the given REPOSITORY
**
** See also: import
*/
/*
** COMMAND: export*
**
** Usage: %fossil export --git [REPOSITORY]
**
** This command is deprecated. Use "fossil git export" instead.
*/
void export_cmd(void){
Stmt q, q2, q3;
Bag blobs, vers;
unsigned int unused_mark = 1;
|
| ︙ | ︙ |