Fossil

Check-in [5ae54b39fd]
Login

Check-in [5ae54b39fd]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:When an ambiguous command prefix is entered, report all possible matches as part of the error message.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 5ae54b39fd739dbc5f597b4638ebc6e7ec3a0216
User & Date: drh 2010-12-19 21:08:09.000
Context
2010-12-20
01:06
Improvements to the graph layout algorithm yielding a more compact graph in many cases. ... (check-in: ea61f4aa55 user: drh tags: trunk)
2010-12-19
21:08
When an ambiguous command prefix is entered, report all possible matches as part of the error message. ... (check-in: 5ae54b39fd user: drh tags: trunk)
20:59
Added a permuted documentation index. ... (check-in: 169a10dd5e user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/main.c.
249
250
251
252
253
254
255









256

257
258
259
260
261
262
263
264
265
  rc = name_search(zCmdName, aCommand, count(aCommand), &idx);
  if( rc==1 ){
    fprintf(stderr,"%s: unknown command: %s\n"
                   "%s: use \"help\" for more information\n",
                   argv[0], zCmdName, argv[0]);
    fossil_exit(1);
  }else if( rc==2 ){









    fprintf(stderr,"%s: ambiguous command prefix: %s\n"

                   "%s: use \"help\" for more information\n",
                   argv[0], zCmdName, argv[0]);
    fossil_exit(1);
  }
  aCommand[idx].xFunc();
  fossil_exit(0);
  /*NOT_REACHED*/
  return 0;
}







>
>
>
>
>
>
>
>
>

>

|







249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
  rc = name_search(zCmdName, aCommand, count(aCommand), &idx);
  if( rc==1 ){
    fprintf(stderr,"%s: unknown command: %s\n"
                   "%s: use \"help\" for more information\n",
                   argv[0], zCmdName, argv[0]);
    fossil_exit(1);
  }else if( rc==2 ){
    int i, n;
    Blob couldbe;
    blob_zero(&couldbe);
    n = strlen(zCmdName);
    for(i=0; i<count(aCommand); i++){
      if( memcmp(zCmdName, aCommand[i].zName, n)==0 ){
        blob_appendf(&couldbe, " %s", aCommand[i].zName);
      }
    }
    fprintf(stderr,"%s: ambiguous command prefix: %s\n"
                   "%s: could be any of:%s\n"
                   "%s: use \"help\" for more information\n",
                   argv[0], zCmdName, argv[0], blob_str(&couldbe), argv[0]);
    fossil_exit(1);
  }
  aCommand[idx].xFunc();
  fossil_exit(0);
  /*NOT_REACHED*/
  return 0;
}