Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/main.cc

    rb4f8808 r49d3128  
    407407
    408408
    409 static const char optstring[] = ":hlLmNnpP:S:twW:D:";
     409static const char optstring[] = ":c:ghlLmNnpP:S:twW:D:";
    410410
    411411enum { PreludeDir = 128 };
    412412static struct option long_opts[] = {
     413        { "colors", required_argument, nullptr, 'c' },
     414        { "gdb", no_argument, nullptr, 'g' },
    413415        { "help", no_argument, nullptr, 'h' },
    414416        { "libcfa", no_argument, nullptr, 'l' },
     
    422424        { "statistics", required_argument, nullptr, 'S' },
    423425        { "tree", no_argument, nullptr, 't' },
    424         { "gdb", no_argument, nullptr, 'g' },
    425426        { "", no_argument, nullptr, 0 },                                        // -w
    426427        { "", no_argument, nullptr, 0 },                                        // -W
     
    430431
    431432static const char * description[] = {
    432         "print help message",                                                           // -h
    433         "generate libcfa.c",                                                            // -l
    434         "generate line marks",                                                          // -L
    435         "do not replace main",                                                          // -m
    436         "do not generate line marks",                                           // -N
    437         "do not read prelude",                                                          // -n
     433        "diagnostic color: never, always, or auto.",          // -c
     434        "wait for gdb to attach",                             // -g
     435        "print help message",                                 // -h
     436        "generate libcfa.c",                                  // -l
     437        "generate line marks",                                // -L
     438        "do not replace main",                                // -m
     439        "do not generate line marks",                         // -N
     440        "do not read prelude",                                // -n
    438441        "generate prototypes for prelude functions",            // -p
    439         "print",                                                                                        // -P
     442        "print",                                              // -P
    440443        "<directory> prelude directory for debug/nodebug",      // no flag
    441444        "<option-list> enable profiling information:\n          counters,heap,time,all,none", // -S
    442         "building cfa standard lib",                                                                    // -t
    443         "wait for gdb to attach",                                                                       // -g
    444         "",                                                                                                     // -w
    445         "",                                                                                                     // -W
    446         "",                                                                                                     // -D
     445        "building cfa standard lib",                          // -t
     446        "",                                                   // -w
     447        "",                                                   // -W
     448        "",                                                   // -D
    447449}; // description
    448450
     
    512514        while ( (c = getopt_long( argc, argv, optstring, long_opts, nullptr )) != -1 ) {
    513515                switch ( c ) {
     516                  case 'c':                                                                             // diagnostic colors
     517                        if ( strcmp( optarg, "always" ) == 0 ) {
     518                                ErrorHelpers::colors = ErrorHelpers::Colors::Always;
     519                        } else if ( strcmp( optarg, "never" ) == 0 ) {
     520                                ErrorHelpers::colors = ErrorHelpers::Colors::Never;
     521                        } else if ( strcmp( optarg, "auto" ) == 0 ) {
     522                                ErrorHelpers::colors = ErrorHelpers::Colors::Auto;
     523                        } // if
     524                        break;
    514525                  case 'h':                                                                             // help message
    515526                        usage( argv );                                                          // no return
Note: See TracChangeset for help on using the changeset viewer.