mirror of
https://github.com/opdavies/versa.git
synced 2025-02-02 07:57:32 +00:00
Add --working-dir
This commit is contained in:
parent
7d1aaf3104
commit
e81e0cef71
|
@ -2,6 +2,7 @@
|
|||
|
||||
## Unrelased
|
||||
|
||||
- Add `--working-dir` to run versa in a different directory.
|
||||
- Add `-t` as a shortcut for `--type`.
|
||||
|
||||
## 0.1.0
|
||||
|
|
11
versa
11
versa
|
@ -24,6 +24,14 @@ $application->addOption(
|
|||
suggestedValues: ['drupal', 'sculpin'],
|
||||
);
|
||||
|
||||
$application->addOption(
|
||||
name: 'working-dir',
|
||||
shortcut: 'd',
|
||||
mode: InputArgument::OPTIONAL,
|
||||
description: 'The project\'s working directory',
|
||||
default: '.',
|
||||
);
|
||||
|
||||
$application->setCode(function (InputInterface $input): int {
|
||||
// TODO: only allow defined commands - build, install, test, run.
|
||||
switch ($input->getArgument('command')) {
|
||||
|
@ -31,6 +39,7 @@ $application->setCode(function (InputInterface $input): int {
|
|||
// TODO: Composer in Docker Compose?
|
||||
$process = new Process(command: ['composer', 'install']);
|
||||
$process->setTty(true);
|
||||
$process->setWorkingDirectory($input->getOption('working-dir'));
|
||||
$process->run();
|
||||
break;
|
||||
|
||||
|
@ -40,6 +49,7 @@ $application->setCode(function (InputInterface $input): int {
|
|||
// TODO: how to pass arbitrary arguments, such as `--port 8001`?
|
||||
$process = new Process(command: ['./vendor/bin/sculpin', 'generate', '--server', '--watch']);
|
||||
$process->setTty(true);
|
||||
$process->setWorkingDirectory($input->getOption('working-dir'));
|
||||
$process->run();
|
||||
break;
|
||||
}
|
||||
|
@ -50,6 +60,7 @@ $application->setCode(function (InputInterface $input): int {
|
|||
// TODO: commands in Docker Compose?
|
||||
$process = new Process(command: ['./vendor/bin/phpunit']);
|
||||
$process->setTty(true);
|
||||
$process->setWorkingDirectory($input->getOption('working-dir'));
|
||||
$process->run();
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue