Skip to content

Commit bcb250f

Browse files
committed
specify the languages to display
1 parent 92959aa commit bcb250f

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

src/Commands/ShowCommand.php

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class ShowCommand extends Command
1414
*
1515
* @var string
1616
*/
17-
protected $signature = 'langman:show {key} {--c|close}';
17+
protected $signature = 'langman:show {key} {--c|close} {--lang=}';
1818

1919
/**
2020
* The name and signature of the console command.
@@ -51,6 +51,13 @@ class ShowCommand extends Command
5151
*/
5252
protected $files;
5353

54+
/**
55+
* Array of selected languages.
56+
*
57+
* @var array
58+
*/
59+
protected $languages;
60+
5461
/**
5562
* ListCommand constructor.
5663
*
@@ -74,8 +81,14 @@ public function handle()
7481

7582
$this->files = $this->filesFromKey();
7683

84+
$this->languages = $this->manager->languages();
85+
86+
if($this->option('lang') != null){
87+
$this->languages = explode(',',$this->option('lang'));
88+
}
89+
7790
$this->table(
78-
array_merge(['key'], $this->manager->languages()),
91+
array_merge(['key'], $this->languages),
7992
$this->tableRows()
8093
);
8194
}
@@ -87,8 +100,6 @@ public function handle()
87100
*/
88101
private function tableRows()
89102
{
90-
$allLanguages = $this->manager->languages();
91-
92103
$output = [];
93104

94105
$filesContent = [];
@@ -110,7 +121,7 @@ private function tableRows()
110121
foreach ($output as $key => $values) {
111122
$original = [];
112123

113-
foreach ($allLanguages as $languageKey) {
124+
foreach ($this->languages as $languageKey) {
114125
$original[$languageKey] = isset($values[$languageKey]) ? $values[$languageKey] : '<bg=red> MISSING </>';
115126
}
116127

0 commit comments

Comments
 (0)