Check-in [d6a93abf2c]
Not logged in

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

Overview
Comment:Remove the "commands" command and replace it with --all, --aux, and --test options to the "help" command.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: d6a93abf2c967ab57a7ec8e3432ff78724208f0f
User & Date: drh 2011-11-04 17:59:33.221
Context
2011-11-04
18:55
Enhance the mkindex.c utility so that it honors #if statements in the source code. check-in: 1e3cae8068 user: drh tags: trunk
18:49
Ensure correct file name on compile errors in translated sources. This helps avoid editing the generated file with vim "quickfix". check-in: ae965ddf5d user: steveb tags: steveb-fixes
17:59
Remove the "commands" command and replace it with --all, --aux, and --test options to the "help" command. check-in: d6a93abf2c user: drh tags: trunk
15:40
No longer display the server-code in info outputs as the server-code is no longer used for anything. Begin recording the location of local checkouts in the ~/.fossil database. check-in: 272e304d3f user: drh tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/main.c.
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
    const char *z = aCommand[i].zName;
    if( (aCommand[i].cmdFlags & cmdMask)==0 ) continue;
    if( zPrefix && memcmp(zPrefix, z, nPrefix)!=0 ) continue;
    aCmd[nCmd++] = aCommand[i].zName;
  }
  multi_column_list(aCmd, nCmd);
}

/*
** COMMAND: commands
**
** Usage: %fossil commands ?--test? ?--all? ?--aux?
**
** List available commands.  If the --test option is used list only unsupported
** commands intended for testing and debugging.  With --all, show all commands
** including test debugging commands.  With --aux, show only the auxiliary
** and less often used commands, and/or command aliases.
*/
void cmd_command_list(void){
  int cmdFlags = CMDFLAG_1ST_TIER | CMDFLAG_2ND_TIER;
  if( find_option("all",0,0)!=0 ){
    cmdFlags |= CMDFLAG_TEST;
  }else if( find_option("test",0,0)!=0 ){
    cmdFlags = CMDFLAG_TEST;
  }else if( find_option("aux",0,0)!=0 ){
    cmdFlags = CMDFLAG_2ND_TIER;
  }else{
    fossil_print("Use --test or --all to see test and debug commands.\n");
  }
  command_list(0, cmdFlags);
}


/*
** COMMAND: test-list-webpage
**
** List all web pages
*/
void cmd_test_webpage_list(void){
  int i, nCmd;
  const char *aCmd[count(aWebpage)];
  for(i=nCmd=0; i<count(aWebpage); i++){
    aCmd[nCmd++] = aWebpage[i].zName;
  }
  multi_column_list(aCmd, nCmd);
}


/*
** COMMAND: version
**
** Usage: %fossil version
**
** Print the source code version number for the fossil executable.







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<














<







707
708
709
710
711
712
713

























714
715
716
717
718
719
720
721
722
723
724
725
726
727

728
729
730
731
732
733
734
    const char *z = aCommand[i].zName;
    if( (aCommand[i].cmdFlags & cmdMask)==0 ) continue;
    if( zPrefix && memcmp(zPrefix, z, nPrefix)!=0 ) continue;
    aCmd[nCmd++] = aCommand[i].zName;
  }
  multi_column_list(aCmd, nCmd);
}


























/*
** COMMAND: test-list-webpage
**
** List all web pages
*/
void cmd_test_webpage_list(void){
  int i, nCmd;
  const char *aCmd[count(aWebpage)];
  for(i=nCmd=0; i<count(aWebpage); i++){
    aCmd[nCmd++] = aWebpage[i].zName;
  }
  multi_column_list(aCmd, nCmd);
}


/*
** COMMAND: version
**
** Usage: %fossil version
**
** Print the source code version number for the fossil executable.
768
769
770
771
772
773
774
775
776
777



778
779
780
781
782
783
784
785
786
787
788
789
790












791
792
793
794
795
796
797
/*
** COMMAND: help
**
** Usage: %fossil help COMMAND
**    or: %fossil COMMAND -help
**
** Display information on how to use COMMAND.  To display a list of
** available commands use:
**
**    %fossil commands



*/
void help_cmd(void){
  int rc, idx;
  const char *z;
  if( g.argc<3 ){
    z = fossil_nameofexe();
    fossil_print(
      "Usage: %s help COMMAND\n"
      "Common COMMANDs:  (use \"%s commands\" for a complete list)\n",
      z, z);
    command_list(0, CMDFLAG_1ST_TIER);
    version_cmd();
    return;












  }
  rc = name_search(g.argv[2], aCommand, count(aCommand), &idx);
  if( rc==1 ){
    fossil_print("unknown command: %s\nAvailable commands:\n", g.argv[2]);
    command_list(0, 0xff);
    fossil_exit(1);
  }else if( rc==2 ){







|

|
>
>
>








|




>
>
>
>
>
>
>
>
>
>
>
>







742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
/*
** COMMAND: help
**
** Usage: %fossil help COMMAND
**    or: %fossil COMMAND -help
**
** Display information on how to use COMMAND.  To display a list of
** available commands one of:
**
**    %fossil help              Show common commands
**    %fossil help --all        Show both command and auxiliary commands
**    %fossil help --test       Show test commands only
**    %fossil help --aux        Show auxiliary commands only
*/
void help_cmd(void){
  int rc, idx;
  const char *z;
  if( g.argc<3 ){
    z = fossil_nameofexe();
    fossil_print(
      "Usage: %s help COMMAND\n"
      "Common COMMANDs:  (use \"%s help --all\" for a complete list)\n",
      z, z);
    command_list(0, CMDFLAG_1ST_TIER);
    version_cmd();
    return;
  }
  if( find_option("all",0,0) ){
    command_list(0, CMDFLAG_1ST_TIER | CMDFLAG_2ND_TIER);
    return;
  }
  if( find_option("aux",0,0) ){
    command_list(0, CMDFLAG_2ND_TIER);
    return;
  }
  if( find_option("test",0,0) ){
    command_list(0, CMDFLAG_TEST);
    return;
  }
  rc = name_search(g.argv[2], aCommand, count(aCommand), &idx);
  if( rc==1 ){
    fossil_print("unknown command: %s\nAvailable commands:\n", g.argv[2]);
    command_list(0, 0xff);
    fossil_exit(1);
  }else if( rc==2 ){