Skip to content

Commit 79d94bf

Browse files
committed
fix(env): Fix the .env and target folder param
1 parent 945539c commit 79d94bf

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

app/Commands/PrefixCommand.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public function handle()
6060
return 1;
6161
}
6262

63-
$targetDirectory = realpath($this->argument('target-directory'));
63+
$targetDirectory = $this->argument('target-directory');
6464

6565
if (!$validator->isValidTargetDirectory($targetDirectory)) {
6666
$this->error("{$targetDirectory} not found");
@@ -125,14 +125,16 @@ protected function initialize(InputInterface $input, OutputInterface $output)
125125
private function argumentOrEnv($input, $key)
126126
{
127127
if (!$input->hasArgument($key) || null === $input->getArgument($key)) {
128-
$input->setArgument($key, env(Str::upper(Str::snake($key))));
128+
$value = env(Str::upper(Str::replace('-', '_', $key)));
129+
$input->setArgument($key, $value);
129130
}
130131
}
131132

132133
private function optionOrEnv($input, $key)
133134
{
134135
if (!$input->hasOption($key) || null === $input->getOption($key)) {
135-
$input->setOption($key, env(Str::upper(Str::snake($key))));
136+
$value = env(Str::upper(Str::replace('-', '_', $key)));
137+
$input->setOption($key, $value);
136138
}
137139
}
138140

app/Support/Validator.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,15 @@ public function isValidSourceDirectory(string $param): bool
3333
return false;
3434
}
3535

36-
return (bool) realpath($param);
36+
return true;
3737
}
3838

3939
public function isValidTargetDirectory(string $param): bool
4040
{
41+
if (empty($param)) {
42+
return false;
43+
}
44+
4145
if (File::exists($param)) {
4246
return File::isDirectory($param);
4347
}

0 commit comments

Comments
 (0)