Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | When reporting the list of matching ambiguous sub-commands, make sure settings with the same prefix are not listed. |
|---|---|
| Timelines: | family | ancestors | descendants | both | ambiguous_cmd_fix |
| Files: | files | file ages | folders |
| SHA3-256: |
bb5162fe163175c0d9f18b6319be7a26 |
| User & Date: | mgagnon 2022-04-05 19:51:56.628 |
| Original Comment: | When reporting the list of mathing ambiguous sub-command, make sure settings with the same prefix are not listed. |
Context
|
2022-04-06
| ||
| 16:42 | Minor consistency fix about ambiguous sub-command dispatch and error reporting, see related [forum:/forumpost/48d6de4f8e2afdde|forum post]. check-in: 512905efd3 user: mgagnon tags: trunk | |
|
2022-04-05
| ||
| 19:51 | When reporting the list of matching ambiguous sub-commands, make sure settings with the same prefix are not listed. Closed-Leaf check-in: bb5162fe16 user: mgagnon tags: ambiguous_cmd_fix | |
| 16:49 | Don't give an "ambiguous command prefix" error when reported ambiguous commands are aliases to each others. Assume alias point to same function pointer and are all consecutive in the aCommand[] list. check-in: 862ce7ce2c user: mgagnon tags: ambiguous_cmd_fix | |
Changes
Changes to src/dispatch.c.
| ︙ | ︙ | |||
207 208 209 210 211 212 213 |
}
}
return 0;
}
/*
** Fill Blob with a space-separated list of all command names that
| | | > > > > > | 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 |
}
}
return 0;
}
/*
** Fill Blob with a space-separated list of all command names that
** match the prefix zPrefix and the eType CMDFLAGS_ bits.
*/
void dispatch_matching_names(
const char *zPrefix, /* name prefix */
unsigned eType, /* CMDFLAG_ bits */
Blob *pList /* space-separated list of command names */
){
int i;
int nPrefix = (int)strlen(zPrefix);
for(i=FOSSIL_FIRST_CMD; i<MX_COMMAND; i++){
if( (aCommand[i].eCmdFlags & eType)==0 ) continue;
if( strncmp(zPrefix, aCommand[i].zName, nPrefix)==0 ){
blob_appendf(pList, " %s", aCommand[i].zName);
}
}
}
/*
|
| ︙ | ︙ |
Changes to src/main.c.
| ︙ | ︙ | |||
909 910 911 912 913 914 915 |
}
}
fossil_exit(0);
#endif
}else if( rc==2 ){
Blob couldbe;
blob_init(&couldbe,0,0);
| | | 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 |
}
}
fossil_exit(0);
#endif
}else if( rc==2 ){
Blob couldbe;
blob_init(&couldbe,0,0);
dispatch_matching_names(zCmdName, CMDFLAG_COMMAND, &couldbe);
fossil_print("%s: ambiguous command prefix: %s\n"
"%s: could be any of:%s\n"
"%s: use \"help\" for more information\n",
g.argv[0], zCmdName, g.argv[0], blob_str(&couldbe), g.argv[0]);
fossil_exit(1);
}
#ifdef FOSSIL_ENABLE_JSON
|
| ︙ | ︙ |