Skip to content

Commit 6c98778

Browse files
committed
namespace module cli commands
1 parent 67042c1 commit 6c98778

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

cli/ob.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,13 @@ private function getCliMap(): array
138138
foreach ($files as $file) {
139139
$cliFileName = pathinfo($file, PATHINFO_FILENAME);
140140
$cliCommand = strtolower(preg_replace('/(?<!^)[A-Z]/', ' $0', $cliFileName));
141-
$cliClassName = "OpenBroadcaster\\CLI\\" . $cliFileName;
141+
142+
if ($subDir === $coreDir) {
143+
$cliClassName = "OpenBroadcaster\\CLI\\{$cliFileName}";
144+
} else {
145+
$moduleName = pathinfo($subDir, PATHINFO_FILENAME);
146+
$cliClassName = "OpenBroadcaster\\Modules\\{$moduleName}\\CLI\\{$cliFileName}";
147+
}
142148

143149
if (isset($cliMap[$cliCommand])) {
144150
echo "Duplicate CLI command found: '{$cliCommand}'. Perhaps one or more models define conflicting commands? Quitting." . PHP_EOL;

modules/Tutorial/cli/Tutorial.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace OpenBroadcaster\CLI;
3+
namespace OpenBroadcaster\Modules\Tutorial\CLI;
44

55
use OpenBroadcaster\Base\CLI;
66

0 commit comments

Comments
 (0)