Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
67e34e52b8 | ||
|
dc96556b5a | ||
|
31822ab7e7 | ||
|
50e9a4c621 | ||
|
0710ef474f |
@@ -19,14 +19,14 @@
|
||||
"bin/baikalstorage"
|
||||
],
|
||||
"require": {
|
||||
"php": ">=5.5",
|
||||
"sabre/dav" : "~4.1.0",
|
||||
"sabre/vobject": "^4.0",
|
||||
"php" : "^7.2 || ^8.0",
|
||||
"sabre/dav" : "~4.3.0",
|
||||
"sabre/vobject": "^4.2.1",
|
||||
"nesbot/carbon": "^2.0.0",
|
||||
"laminas/laminas-validator": "^2.13",
|
||||
"laminas/laminas-stdlib": "^3.2",
|
||||
"psr/container": "^1.0",
|
||||
"symfony/config": "3.4",
|
||||
"symfony/config": "3.4|^4.0|^5.0",
|
||||
"symfony/process": "^3.4|^4.0|^5.0",
|
||||
"monolog/monolog": "^2.0",
|
||||
"symfony/yaml": "~3.0|~4.0",
|
||||
|
@@ -22,7 +22,12 @@ class CreateConfigFileCommand extends Command {
|
||||
|
||||
public function addtaskwarriorConfig() {
|
||||
$configs = [];
|
||||
$filePath = $this->io->askQuestion(new Question('Where is the location for the taskrc file?'));
|
||||
$taskrcQuestion = new Question('Where is the location for the taskrc file?');
|
||||
$self = $this;
|
||||
$taskrcQuestion->setAutocompleterCallback(function(string $input) use ($self) {
|
||||
return $self->autocompleteFilePathCallback($input);
|
||||
});
|
||||
$filePath = $this->io->askQuestion($taskrcQuestion);
|
||||
$taskrcFilePath = $filePath . '/.taskrc';
|
||||
if (!file_exists($taskrcFilePath)) {
|
||||
throw new \RuntimeException("The taskrc file at $taskrcFilePath does not exist");
|
||||
@@ -70,7 +75,10 @@ class CreateConfigFileCommand extends Command {
|
||||
|
||||
// TODO: move create config file code block to function
|
||||
$question = new Question('Where to create `config.yaml` configuration file?');
|
||||
$question->setAutocompleterCallback($this->autocompleteFilePathCallback);
|
||||
$self = $this;
|
||||
$question->setAutocompleterCallback(function(string $input) use ($self) {
|
||||
return $self->autocompleteFilePathCallback($input);
|
||||
});
|
||||
$filePath = $this->io->askQuestion($question);
|
||||
|
||||
try {
|
||||
@@ -125,7 +133,14 @@ class CreateConfigFileCommand extends Command {
|
||||
$this->configs['general'] = [];
|
||||
if ($this->io->confirm('Enable logging?')) {
|
||||
$this->configs['general']['logger'] = [];
|
||||
$logFilePath = $this->io->askQuestion(new Question('Where to create log file?'));
|
||||
|
||||
$logFileQuestion = new Question('Where to create log file?');
|
||||
$self = $this;
|
||||
$logFileQuestion->setAutocompleterCallback(function(string $input) use ($self) {
|
||||
return $self->autocompleteFilePathCallback($input);
|
||||
});
|
||||
$logFilePath = $this->io->askQuestion($logFileQuestion);
|
||||
|
||||
$this->configs['general']['logger']['file'] = $this->verifyAndCreateFile($logFilePath, CreateConfigFileCommand::$LOGGER_FILE_NAME);
|
||||
|
||||
$logLevelChoiceQuestion = new ChoiceQuestion('Log level (defaults to ERROR)', array_keys(Monolog::getLevels()), 4);
|
||||
|
@@ -1,4 +1,4 @@
|
||||
<?php
|
||||
<?php
|
||||
|
||||
namespace Aerex\BaikalStorage\Configs;
|
||||
|
||||
@@ -21,9 +21,9 @@ class ConfigBuilder implements ConfigurationInterface {
|
||||
}
|
||||
|
||||
public function getConfigTreeBuilder() {
|
||||
$treeBuilder = new TreeBuilder();
|
||||
$rootNode = $treeBuilder->root('configs');
|
||||
$ref = $rootNode->children()
|
||||
$treeBuilder = new TreeBuilder('configs', 'array');
|
||||
$rootNode = $treeBuilder->getRootNode();
|
||||
$ref = $rootNode->children()
|
||||
->arrayNode('general')
|
||||
->children()
|
||||
->arrayNode('logger')
|
||||
@@ -35,12 +35,12 @@ class ConfigBuilder implements ConfigurationInterface {
|
||||
->validate()
|
||||
->IfNotInArray(['DEBUG', 'INFO', 'NOTICE', 'WARNING', 'ERROR', 'CRITICAL', 'ALERT', 'EMERGENCY'])
|
||||
->thenInvalid('Invalid log level %s')
|
||||
->end()
|
||||
->end()
|
||||
->end()
|
||||
->end()
|
||||
->end()
|
||||
->end()
|
||||
->end()
|
||||
->end()
|
||||
->end()
|
||||
->end()
|
||||
->end()
|
||||
->end()
|
||||
->arrayNode('storages')
|
||||
->children();
|
||||
foreach ($this->configs as $config) {
|
||||
|
@@ -1,4 +1,4 @@
|
||||
<?php
|
||||
<?php
|
||||
|
||||
namespace Aerex\BaikalStorage\Configs;
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
<?php
|
||||
<?php
|
||||
|
||||
namespace Aerex\BaikalStorage;
|
||||
|
||||
@@ -14,20 +14,19 @@ class Console extends AbstractConsole {
|
||||
|
||||
private function convertToString($input) {
|
||||
if (is_array($input)) {
|
||||
return json_encode($input);
|
||||
return json_encode($input);
|
||||
}
|
||||
return $input;
|
||||
}
|
||||
|
||||
public function execute($cmd, $args, $input = null, $envs = []) {
|
||||
$stdin[] = $cmd;
|
||||
$stdin = array_merge($stdin, $this->defaultArgs, $args);
|
||||
$stdin = array_merge($stdin, $this->defaultArgs, $args);
|
||||
|
||||
if (isset($input)) {
|
||||
$input = $this->convertToString($input);
|
||||
}
|
||||
$process = new Process(implode(' ', $stdin), null, $envs, $input);
|
||||
$process->inheritEnvironmentVariables();
|
||||
$process = new Process($stdin, null, $envs, $input);
|
||||
|
||||
try {
|
||||
$process->mustRun();
|
||||
|
Reference in New Issue
Block a user