Skip to content

Commit b9908e4

Browse files
committed
Ask confirmation before overwriting config
1 parent 100f56e commit b9908e4

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

features/shell_alias.feature

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,5 @@ Feature: Default aliases
2020
| mv cms smc |
2121
| ls |
2222
| ls cms |
23+
| sl cms foobar |
24+
| cat cms |

src/PHPCR/Shell/Console/Command/Shell/ConfigInitCommand.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@ public function execute(InputInterface $input, OutputInterface $output)
5252
throw new \Exception('Dist (source) file "' . $srcFile . '" does not exist.');
5353
}
5454

55+
if (file_exists($destFile)) {
56+
if (!$this->getHelper('dialog')->askConfirmation($output, '"' . $configFilename . '" already exists, do you want to overwrite it?')) {
57+
return 0;
58+
}
59+
}
60+
5561
$fs->copy($srcFile, $destFile);
5662
$this->logCreation($destFile);
5763
}

src/PHPCR/Shell/Resources/config.dist/alias.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# MySQL commands
22
use: workspace:use
3-
"show databases": workspace:list
3+
workspaces: workspace:list
44
select: query:select
55

66
# Filesystem commands

0 commit comments

Comments
 (0)