Skip to content

Commit 2431a0c

Browse files
committed
[sync] Update embedded LibCommand from standalone
1 parent 89d5d60 commit 2431a0c

3 files changed

Lines changed: 7 additions & 1 deletion

File tree

src/imperazim/command/Command.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ public function execute(
210210
return;
211211
}
212212
// Handle subcommands
213-
if (!empty($rawArgs)) {
213+
if (!empty($rawArgs) && !empty($this->getSubCommands())) {
214214
$key = strtolower(array_shift($rawArgs));
215215
foreach ($this->getSubCommands() as $sub) {
216216
$name = $sub->getName();
@@ -220,6 +220,7 @@ public function execute(
220220
return;
221221
}
222222
}
223+
array_unshift($rawArgs, $key);
223224
}
224225

225226
// Check constraints

src/imperazim/command/dynamic/DynamicCommand.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ public function withPermission(string $permission): self {
126126
*/
127127
public function addConstraint(Constraint $constraint): self {
128128
$this->config['constraints'][] = $constraint;
129+
parent::addConstraint($constraint);
129130
return $this;
130131
}
131132

@@ -137,6 +138,7 @@ public function addConstraint(Constraint $constraint): self {
137138
*/
138139
public function addArgument(Argument $argument): self {
139140
$this->config['arguments'][] = $argument;
141+
parent::addArgument($argument);
140142
return $this;
141143
}
142144

@@ -148,6 +150,7 @@ public function addArgument(Argument $argument): self {
148150
*/
149151
public function addSubCommand(SubCommand $subCommand): self {
150152
$this->config['subcommands'][] = $subCommand;
153+
parent::addSubCommand($subCommand);
151154
return $this;
152155
}
153156

src/imperazim/command/dynamic/DynamicSubCommand.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ public function setPermission(string $permission): self {
111111
*/
112112
public function addConstraint(Constraint $constraint): self {
113113
$this->config['constraints'][] = $constraint;
114+
parent::addConstraint($constraint);
114115
return $this;
115116
}
116117

@@ -122,6 +123,7 @@ public function addConstraint(Constraint $constraint): self {
122123
*/
123124
public function addArgument(Argument $argument): self {
124125
$this->config['arguments'][] = $argument;
126+
parent::addArgument($argument);
125127
return $this;
126128
}
127129

0 commit comments

Comments
 (0)