Skip to content

A tiny library to provide support abouts args given to a script

Notifications You must be signed in to change notification settings

alphayax/get_opt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Get Opt

A library to manage scripts arguments

Latest Stable Version Latest Unstable Version pakagist

Travis Coverage Status Codacy Badge

License Total Downloads

GetOpt

A class to parse parameters given to a script

$Args = new GetOpt();
$Args->addShortOpt( 'd', 'Debug mode');
$Args->addLongOpt( 'dry-run', 'Dry Run mode');
$Args->addOpt( 'v', 'verbose', 'Verbose Mode');
$Args->parse();

$isDryRun  = $Args->hasOption( 'dry-run');
$isVerbose = $Args->hasOption( 'v') || $Args->hasOption( 'verbose');

Auto-generated Help

Example of help output (if the -h or --help flag is specified) :

    Description
   	This script is a tiny example to show library features
   
   Usage
   	/usr/bin/php a.php [OPTIONS]
   
   Options
	-d        	              	Debug mode
	          	--dry-run     	Dry Run mode
	          	--file <value>	Specify the file name
	-h        	--help        	Display help
	-n <value>	              	[REQUIRED] Number of lines
	-v        	--verbose     	Verbose Mode

About

A tiny library to provide support abouts args given to a script

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages