@@ 22-32 (lines=11) @@ | ||
19 | * |
|
20 | * @return string |
|
21 | */ |
|
22 | protected function getOptionOrAsk($option, $question, $default = null) |
|
23 | { |
|
24 | $value = $this->input->getOption($option); |
|
25 | if (is_null($value)) { |
|
26 | $this->output->writeln(''); |
|
27 | $value = $this->dialog->ask($this->output, '<question>'.$question.' ?</question> ', $default); |
|
28 | $this->output->writeln('<comment>'.$question.' is now "'.$value.'"</comment>'); |
|
29 | } |
|
30 | ||
31 | return $value; |
|
32 | } |
|
33 | ||
34 | /** |
|
35 | * @param string $option |
|
@@ 78-93 (lines=16) @@ | ||
75 | * |
|
76 | * @return string |
|
77 | */ |
|
78 | protected function getOptionOrAskAndValidate($option, $question, \Closure $callback, $default = null) |
|
79 | { |
|
80 | $value = $this->input->getOption($option); |
|
81 | if (is_null($value)) { |
|
82 | $this->output->writeln(''); |
|
83 | $value = $this->dialog->askAndValidate( |
|
84 | $this->output, |
|
85 | '<question>'.$question.' ?</question> ', |
|
86 | $callback, |
|
87 | $default |
|
88 | ); |
|
89 | $this->output->writeln('<comment>'.$question.' is now "'.$value.'"</comment>'); |
|
90 | } |
|
91 | ||
92 | return $value; |
|
93 | } |
|
94 | } |
|
95 |