Skip to content
This repository was archived by the owner on Mar 30, 2024. It is now read-only.

Commit a4ceeff

Browse files
committed
Better CLI prints
1 parent 504cdb0 commit a4ceeff

File tree

2 files changed

+20
-11
lines changed

2 files changed

+20
-11
lines changed

core/CLI.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ private function record(){
5454
if( isset($this->parser->getCommands()[0]) && $this->parser->getCommands()[0] == 'inTerminalDialog' ){
5555
(new Recorder(true))->record();
5656
}
57-
else{
57+
else {
5858
$this->output->print(array(
5959
'Force new record',
6060
array('Add command '. CLIOutput::colorString('inTerminalDialog', CLIOutput::BLUE) . ' to do a normal record using the InTerminalDialog.')

core/Settings.php

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ private function parseCommands(array $commands) : void {
2727
}
2828

2929
private function categories(array $commands) : void {
30+
$this->output->print(array(
31+
'Settings -> Categories'
32+
));
3033
if( isset($commands[0])){
3134
$cmd = $commands[0];
3235
if( in_array($cmd, ['add', 'del', 'list'])){
@@ -50,11 +53,14 @@ private function categories(array $commands) : void {
5053
}
5154
}
5255
else if ($cmd == 'del'){
53-
$clist = array("ID\t:\tCategory");
56+
$clist = array();
5457
foreach( $cats as $id => $cat ){
55-
$clist[] = $id . "\t:\t" . $cat;
58+
$clist[] = array(
59+
'ID' => strval($id),
60+
'Category' => $cat
61+
);
5662
}
57-
$this->output->print($clist, null, 2);
63+
$this->output->table($clist);
5864

5965
$delid = $this->output->readline("Type ID to delete category, else abort:", CLIOutput::RED, 1);
6066
if( isset($cats[$delid]) ){
@@ -72,17 +78,19 @@ private function categories(array $commands) : void {
7278
}
7379
}
7480
else {
75-
$clist = array("ID\t:\tCategory");
81+
$clist = array();
7682
foreach( $cats as $id => $cat ){
77-
$clist[] = $id . "\t:\t" . $cat;
83+
$clist[] = array(
84+
'ID' => strval($id),
85+
'Category' => $cat
86+
);
7887
}
79-
$this->output->print($clist, null, 1);
88+
$this->output->table($clist);
8089
}
8190
return;
8291
}
8392
}
8493
$this->output->print(array(
85-
'Settings -> Categories',
8694
array(
8795
'There are more commands for categories',
8896
array(
@@ -94,6 +102,10 @@ private function categories(array $commands) : void {
94102
}
95103

96104
private function merge() : void {
105+
$this->output->print(array(
106+
'Settings -> Merge'
107+
));
108+
97109
$s = new StatsData();
98110
$allnames = $s->getAllNames();
99111
$color = null;
@@ -136,8 +148,5 @@ private function commandList() : void {
136148
)
137149
));
138150
}
139-
140-
141-
142151
}
143152
?>

0 commit comments

Comments
 (0)