#!/usr/bin/env php 'Unstow files', 'b' => 'Backup existing files', 'f' => 'Force overwrite', 'w' => 'Unwrap folders'], ['stow-directory' => 'The directory to stow'] ); $parsed = $argvParser->parseArgv($argv); if ($parsed === false) { lexit('Usage: ' . __FILE__ . ' ' . $argvParser->getOptionsHelp(), 1); } $cwd = getcwd(); $action = $parsed->get('u') ? stow::ACTION_UNSTOW : stow::ACTION_STOW; $backup = $parsed->get('b'); $force = $parsed->get('f'); $unwrap = $parsed->get('w'); $stowName = $parsed->get('stow-directory'); $stowPath = path($cwd, $stowName); $config = new config($stowPath); $targetPath = $config->get('targetPath', dirname($stowPath, 2)); if (!is_dir($stowPath)) { lexit("Directory '$stowName' does not exist", 1); } $stow = new stow($action, $backup, $force, $unwrap); $stow->run($stowPath, $targetPath); lexit('Done successfully');