1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace clipr; |
4
|
|
|
|
5
|
|
|
|
6
|
|
|
use kalanis\kw_clipr\Clipr\Useful; |
7
|
|
|
use kalanis\kw_clipr\Output\TPrettyTable; |
8
|
|
|
use kalanis\kw_clipr\Tasks\ATask; |
9
|
|
|
use kalanis\kw_clipr\Tasks\Params; |
10
|
|
|
|
11
|
|
|
|
12
|
|
|
class Info extends ATask |
13
|
|
|
{ |
14
|
|
|
use TPrettyTable; |
15
|
|
|
|
16
|
2 |
|
public function desc(): string |
17
|
|
|
{ |
18
|
2 |
|
return 'Info about Clipr and its inputs'; |
19
|
|
|
} |
20
|
|
|
|
21
|
2 |
|
public function process(): int |
22
|
|
|
{ |
23
|
2 |
|
$cliprPath = Useful::getNthParam($this->inputs->getInArray(), 0) ?? 'clipr'; |
24
|
2 |
|
$this->writeLn('<yellow><bluebg>+======================+</bluebg></yellow>'); |
25
|
2 |
|
$this->writeLn('<yellow><bluebg>| kw_clipr |</bluebg></yellow>'); |
26
|
2 |
|
$this->writeLn('<yellow><bluebg>+======================+</bluebg></yellow>'); |
27
|
2 |
|
$this->writeLn('<yellow><bluebg>| Info about system |</bluebg></yellow>'); |
28
|
2 |
|
$this->writeLn('<yellow><bluebg>+======================+</bluebg></yellow>'); |
29
|
2 |
|
$this->writeLn(); |
30
|
2 |
|
$this->writeLn('kw_clipr is a simple framework for running tasks from CLI.'); |
31
|
2 |
|
$this->writeLn('It calls task from predefined sources and allows them to run.'); |
32
|
2 |
|
$this->writeLn('Command line query is simple - "clipr task --rest-of-params"'); |
33
|
2 |
|
$this->writeLn('For list available tasks use following command:'); |
34
|
2 |
|
$this->writeLn("<lcyan>$cliprPath clipr/Lister</lcyan>"); |
35
|
2 |
|
$this->writeLn('For info about task use following command:'); |
36
|
2 |
|
$this->writeLn("<lcyan>$cliprPath clipr/Help task</lcyan>"); |
37
|
2 |
|
$this->writeLn('Help inside the task might show other things. That depends on task author.'); |
38
|
2 |
|
$this->writeLn('Also color output depends on task author. And your terminal.'); |
39
|
2 |
|
$this->writeLn(); |
40
|
2 |
|
$this->writeLn('And this is list of default variables available for each task:'); |
41
|
2 |
|
$this->setTableHeaders(['local variables', 'cli key', 'current value']); |
42
|
2 |
|
foreach ($this->params->getAvailableOptions() as $option) { |
43
|
|
|
/** @var Params\Option $option */ |
44
|
2 |
|
$this->setTableDataLine([$option->getVariable(), $option->getCliKey(), $option->getValue()]); |
45
|
|
|
} |
46
|
2 |
|
$this->dumpTable(); |
47
|
2 |
|
return static::STATUS_SUCCESS; |
48
|
|
|
} |
49
|
|
|
} |
50
|
|
|
|