available(); foreach($modules as $module=>$versions){ foreach($versions as $version) // if enabled if( $version['enabled'] ) echo " [x] $module (version ".$version['version'].")\n"; else echo " [ ] $module (version ".$version['version'].")\n"; echo "\n"; } } break; /* (2) Enables a module and its version ---------------------------------------------------------*/ case 'enable': { if( $arglen < 2 || !preg_match("/^(.+):([0-9\.-]+)$/i", $arguments[1], $matches) ){ echo "You must specify @module:@version.\n"; return; } $err = $exporter->enable($matches[1], $matches[2]); /* (1) Managing state */ if( $err === true ) echo "\n\n** success **\n"; else echo $err; } break; /* (3) Disabled a module ---------------------------------------------------------*/ case 'disable': { if( $arglen < 2 ){ echo "You must specify @module.\n"; return; } $err = $exporter->disable($arguments[1]); /* (1) Managing state */ if( $err === true ) echo "\n\n** success **\n"; else echo $err; } break; /* (3) Builds a project ---------------------------------------------------------*/ case 'build': { if( $arglen < 2 || !is_dir($arguments[1]) ){ echo "You must specify your project root's @path.\n"; return; } // Removes the optional final '/' $arguments[1] = preg_replace('/^(.+)\/$/', '$1', $arguments[1]); $err = $exporter->build($arguments[1]); /* (1) Managing state */ if( $err === true ) echo "\n\n** success **\n"; else echo $err; } break; } ?>