Add extra output to stow
This commit is contained in:
@ -25,7 +25,11 @@ $stowName = $parsed->get('stow-directory');
|
||||
$stowPath = path($cwd, $stowName);
|
||||
|
||||
$config = new config($stowPath, stow::CONFIG_FILE_NAME);
|
||||
if ($config->configExists()) {
|
||||
line('Config file exists, using config');
|
||||
}
|
||||
$targetPath = $config->get('targetPath', dirname($stowPath, 2));
|
||||
line(sprintf('Stowing %s to %s', $stowName, $targetPath));
|
||||
|
||||
if (!is_dir($stowPath)) {
|
||||
lexit("Directory '$stowName' does not exist", 1);
|
||||
|
@ -38,9 +38,14 @@ readonly class config
|
||||
private string $fileName = 'config.php',
|
||||
) {}
|
||||
|
||||
public function configExists(): bool
|
||||
{
|
||||
return file_exists($this->getConfigFile());
|
||||
}
|
||||
|
||||
public function get(string $key, mixed $default = null): mixed
|
||||
{
|
||||
if (!file_exists($this->getConfigFile())) {
|
||||
if (!$this->configExists()) {
|
||||
return $default;
|
||||
}
|
||||
$config = include $this->getConfigFile();
|
||||
|
Reference in New Issue
Block a user