diff options
author | Filipp Lepalaan <f@230.to> | 2013-09-05 17:13:11 +0300 |
---|---|---|
committer | Filipp Lepalaan <f@230.to> | 2013-09-05 17:13:11 +0300 |
commit | 71d9f4c8abd4158eee11d758ab418e2ebcfa5c6d (patch) | |
tree | d5a61fbb31f88ea9b6f2a302cad11d2a5f744028 /gsxcl | |
parent | 917dcc057435566653d3581437f672a115e70344 (diff) | |
download | gsxlib-71d9f4c8abd4158eee11d758ab418e2ebcfa5c6d.tar.gz gsxlib-71d9f4c8abd4158eee11d758ab418e2ebcfa5c6d.tar.bz2 gsxlib-71d9f4c8abd4158eee11d758ab418e2ebcfa5c6d.zip |
Added --debug switch to gsxcl
Diffstat (limited to 'gsxcl')
-rwxr-xr-x | gsxcl | 15 |
1 files changed, 9 insertions, 6 deletions
@@ -14,10 +14,6 @@ * http://sam.zoy.org/wtfpl/COPYING for more details. */ -if (TRUE) { - error_reporting( E_ALL|E_STRICT ); -} - $nouns = array( 'repair', 'part', 'dispatch', 'order', 'return', 'warranty' ); $verbs = array( 'create', 'lookup', 'update', 'status', 'label', 'pending', 'details' ); @@ -29,7 +25,8 @@ require 'gsxlib.php'; if( count( $argv ) < 6 ) { echo <<<EOT -usage: gsxcl -s sold-to -u username -p password [-r region] [-e environment] [-f format] verb noun +usage: gsxcl [--debug] -s sold-to -u username -p password [-r region] [-e environment] [-f format] verb noun + --debug Report all errors -s sold-to your GSX Sold-To account -u username the Apple ID with GSX WS API access -p password the password for the Apple ID @@ -46,7 +43,7 @@ EOT; exit(); } -$opts = getopt( 's:u:p:r:e:m:q:f:d:' ); +$opts = getopt( 's:u:p:r:e:m:q:f:d:', array( 'debug' )); list( $verb, $noun ) = array_slice( $argv, -2, 2 ); if( !in_array( $noun, $nouns )) { @@ -61,6 +58,12 @@ $region = ( isset( $opts['r'] )) ? $opts['r'] : 'emea'; $format = ( isset($opts['f'] )) ? $opts['f'] : 'print_r'; $environment = ( isset( $opts['e'] )) ? $opts['e'] : null; +if( array_key_exists('debug', $opts )) { + error_reporting( E_ALL|E_STRICT ); +} else { + error_reporting(0); +} + switch( $noun ) { case 'warranty': |