aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFilipp Lepalaan <f@230.to>2013-09-05 17:13:11 +0300
committerFilipp Lepalaan <f@230.to>2013-09-05 17:13:11 +0300
commit71d9f4c8abd4158eee11d758ab418e2ebcfa5c6d (patch)
treed5a61fbb31f88ea9b6f2a302cad11d2a5f744028
parent917dcc057435566653d3581437f672a115e70344 (diff)
downloadgsxlib-71d9f4c8abd4158eee11d758ab418e2ebcfa5c6d.tar.gz
gsxlib-71d9f4c8abd4158eee11d758ab418e2ebcfa5c6d.tar.bz2
gsxlib-71d9f4c8abd4158eee11d758ab418e2ebcfa5c6d.zip
Added --debug switch to gsxcl
-rwxr-xr-xgsxcl15
1 files changed, 9 insertions, 6 deletions
diff --git a/gsxcl b/gsxcl
index cc03e6f..0d5e9aa 100755
--- a/gsxcl
+++ b/gsxcl
@@ -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':