PHP: Add lexit function for easy exiting with text
This commit is contained in:
@ -12,8 +12,7 @@ $argvParser = new ArgvParser(
|
||||
);
|
||||
$parsed = $argvParser->parseArgv($argv);
|
||||
if ($parsed === false) {
|
||||
line('Usage: ' . __FILE__ . ' ' . $argvParser->getOptionsHelp());
|
||||
exit(1);
|
||||
lexit('Usage: ' . __FILE__ . ' ' . $argvParser->getOptionsHelp(), 1);
|
||||
}
|
||||
|
||||
$cwd = getcwd();
|
||||
@ -29,11 +28,10 @@ $config = new config($stowPath);
|
||||
$targetPath = $config->get('targetPath', dirname($stowPath, 2));
|
||||
|
||||
if (!is_dir($stowPath)) {
|
||||
line("Directory '$stowName' does not exist");
|
||||
exit(1);
|
||||
lexit("Directory '$stowName' does not exist", 1);
|
||||
}
|
||||
|
||||
$stow = new stow($action, $backup, $force, $unwrap);
|
||||
$stow->run($stowPath, $targetPath);
|
||||
|
||||
exit(0);
|
||||
lexit('Done successfully');
|
Reference in New Issue
Block a user