Skip to content

Commit

Permalink
Merge pull request phalcon#15 from racklin/enhancement/help
Browse files Browse the repository at this point in the history
Added `zephir help` command to zephir.
  • Loading branch information
sjinks committed Oct 8, 2013
2 parents eb439ee + 4f26d50 commit d004835
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion Library/Compiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,11 @@ public static function boot()
if (isset($_SERVER['argv'][1])) {
$action = $_SERVER['argv'][1];
} else {
$action = 'compile';
if (!file_exists('config.json')) {
$action = 'help';
}else {
$action = 'compile';
}
}

/**
Expand Down Expand Up @@ -711,6 +715,9 @@ public static function boot()
case 'version':
echo self::VERSION, PHP_EOL;
break;
case 'help':
$c->help();
break;
default:
throw new Exception('Unrecognized action "' . $action . '"');
}
Expand All @@ -720,6 +727,29 @@ public static function boot()
}
}


/**
* Display zephir commands help
*/
public function help() {

echo "zephir version " , self::VERSION, PHP_EOL, PHP_EOL;
echo "Usage: ", PHP_EOL;
echo "\tcommand [options]", PHP_EOL;
echo PHP_EOL;
echo "Available commands:", PHP_EOL;
echo sprintf("\t%-20s%s\n","init", "Initializes a Zephir extension");
echo sprintf("\t%-20s%s\n","compile", "Compile and installs an extension");
echo sprintf("\t%-20s%s\n","compile-only", "Compile an extension");
echo sprintf("\t%-20s%s\n","version", "Display zephir version");
echo sprintf("\t%-20s%s\n","help", "Displays help");
echo PHP_EOL;
echo "Options:", PHP_EOL;
echo sprintf("\t%-20s%s\n","-fno-([a-z0-9\-]+)", "Setting options to Compiler");
echo sprintf("\t%-20s%s\n","-W([a-z0-9\-]+)", "Setting warning options to Compiler");

}

/**
* Returns a short path
*
Expand Down

0 comments on commit d004835

Please sign in to comment.