Fossil

Check-in [3a9017f9d1]
Login

Check-in [3a9017f9d1]

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

Overview
Comment:Rework -help implementation so -help can be added to any command line even if it already contained an option that the help command would have interpreted. For example, "fossil clean -x -help" now prints help about the clean command, whereas before it was did the same as "fossil help -x", i.e. list auxiliary commands without mentioning clean. Make sure to fall back on the current implementation so "fossil -help -x" and such still work correctly.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | andygoth-help-option
Files: files | file ages | folders
SHA1: 3a9017f9d1d8b1862a94ae13bfc9bb2d22e6740e
User & Date: andygoth 2015-06-19 16:19:58.862
Context
2015-06-22
04:37
Integrate andygoth-help-option. ... (check-in: 100ac83b64 user: andygoth tags: trunk)
2015-06-19
16:19
Rework -help implementation so -help can be added to any command line even if it already contained an option that the help command would have interpreted. For example, "fossil clean -x -help" now prints help about the clean command, whereas before it was did the same as "fossil help -x", i.e. list auxiliary commands without mentioning clean. Make sure to fall back on the current implementation so "fossil -help -x" and such still work correctly. ... (Closed-Leaf check-in: 3a9017f9d1 user: andygoth tags: andygoth-help-option)
14:40
Remove ugly and zero-information comment text from linenoise.c. ... (check-in: 7bc11da241 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/main.c.
681
682
683
684
685
686
687
688


689
690
691


692



693





694
695

696
697
698
699
700
701
702
703
    fossil_init_flags_from_options();
    if( find_option("utc",0,0) ) g.fTimeFormat = 1;
    if( find_option("localtime",0,0) ) g.fTimeFormat = 2;
    if( zChdir && file_chdir(zChdir, 0) ){
      fossil_fatal("unable to change directories to %s", zChdir);
    }
    if( find_option("help",0,0)!=0 ){
      /* --help anywhere on the command line is translated into


      ** "fossil help argv[1] argv[2]..." */
      int i;
      char **zNewArgv = fossil_malloc( sizeof(char*)*(g.argc+2) );


      for(i=1; i<g.argc; i++) zNewArgv[i+1] = g.argv[i];



      zNewArgv[i+1] = 0;





      zNewArgv[0] = g.argv[0];
      zNewArgv[1] = "help";

      g.argc++;
      g.argv = zNewArgv;
    }
    zCmdName = g.argv[1];
  }
#ifndef _WIN32
  /* There is a bug in stunnel4 in which it sometimes starts up client
  ** processes without first opening file descriptor 2 (standard error).







|
>
>
|
|

>
>
|
>
>
>
|
>
>
>
>
>
|
|
>
|







681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
    fossil_init_flags_from_options();
    if( find_option("utc",0,0) ) g.fTimeFormat = 1;
    if( find_option("localtime",0,0) ) g.fTimeFormat = 2;
    if( zChdir && file_chdir(zChdir, 0) ){
      fossil_fatal("unable to change directories to %s", zChdir);
    }
    if( find_option("help",0,0)!=0 ){
      /* If --help is found anywhere on the command line, translate the command
       * to "fossil help cmdname" where "cmdname" is the first argument that
       * does not begin with a "-" character.  If all arguments start with "-",
       * translate to "fossil help argv[1] argv[2]...". */
      int i, nNewArgc;
      char **zNewArgv = fossil_malloc( sizeof(char*)*(g.argc+2) );
      zNewArgv[0] = g.argv[0];
      zNewArgv[1] = "help";
      for(i=1; i<g.argc; i++){
        if( g.argv[i][0]!='-' ){
          nNewArgc = 3;
          zNewArgv[2] = g.argv[i];
          zNewArgv[3] = 0;
          break;
        }
      }
      if( i==g.argc ){
        for(i=1; i<g.argc; i++) zNewArgv[i+1] = g.argv[i];
        nNewArgc = g.argc+1;
        zNewArgv[i+1] = 0;
      }
      g.argc = nNewArgc;
      g.argv = zNewArgv;
    }
    zCmdName = g.argv[1];
  }
#ifndef _WIN32
  /* There is a bug in stunnel4 in which it sometimes starts up client
  ** processes without first opening file descriptor 2 (standard error).