Assembla home | Assembla project page
 

Changeset 9

Show
Ignore:
Timestamp:
06/06/07 15:31:48 (1 year ago)
Author:
major
Message:

Added option to disable colors.
Explanation option is disabled by default.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • mysqltuner.pl

    r8 r9  
    1313        "noinfo" => 0, 
    1414        "notitle" => 0, 
    15         "noexplain" => 0, 
     15        "withexplain" => 0, 
    1616        "explainonly" => 0, 
     17        "nocolor" => 0, 
    1718    ); 
    1819 
     
    2324        'noinfo', 
    2425        'notitle', 
    25         'noexplain', 
     26        'withexplain', 
    2627        'explainonly', 
     28        'nocolor', 
    2729        'help', 
    2830    ); 
     
    4446        "       --noinfo        Remove informational responses\n". 
    4547        "       --notitle       Remove section title headers\n". 
    46         "       --noexplain     Remove verbose explanations\n". 
     48        "       --withexplain     Add verbose explanations\n". 
    4749        "       --explainonly   Provide only long text explanations, no bullets/titles\n". 
     50        "       --nocolor       Don't print output in color\n". 
    4851        "\n"; 
    4952    exit; 
     
    5154 
    5255# CONFIGURATION ITEMS 
    53 my $revision = "1"; 
    54 my $good = "[\e[00;32mOK\e[00m]"; 
    55 my $bad = "[\e[00;31m!!\e[00m]"; 
    56 my $info = "[\e[00;34m--\e[00m]"; 
     56my ($good,$bad,$info); 
     57if ($opt{nocolor} == 0) { 
     58    $good = "[\e[00;32mOK\e[00m]"; 
     59    $bad = "[\e[00;31m!!\e[00m]"; 
     60    $info = "[\e[00;34m--\e[00m]"; 
     61} else { 
     62    $good = "[OK]"; 
     63    $bad = "[!!]"; 
     64    $info = "[--]"; 
     65
    5766 
    5867if ($opt{explainonly} == 1) { 
     
    8998my $exptext; 
    9099sub explainprint { 
    91     if ($opt{noexplain} == 1) { return 0; } 
     100    if ($opt{withexplain} == 0) { return 0; } 
    92101    my $text = shift; 
    93102    if ($opt{explainonly} == 0) { 
     
    616625# --------------------------------------------------------------------------- 
    617626print   "     MySQL High-Performance Tuner - Major Hayden <major.hayden\@rackspace.com>\n". 
    618         "     Bug reports, feature requests, downloads at mysqltuner.com\n"; 
     627        "     Bug reports, feature requests, downloads at mysqltuner.com\n". 
     628        "     Run with '--help' for additional options and output filtering\n"; 
    619629mysql_install_ok;               # Check to see if MySQL is installed 
    620630os_setup;                       # Set up some OS variables