Skip to content

Commit 4c62f52

Browse files
matthewnessworthyroshangautam
authored andcommitted
[feature] sort commands by command name
- sort available commands by name - use command name as the text value in select
1 parent 348c3b6 commit 4c62f52

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

resources/views/tasks/form.blade.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@
3434
<select id="command" name="command" class="uk-select" placeholder="Click here to select one of the available commands">
3535
<option value="">Select a command</option>
3636
@foreach ($commands as $command)
37-
<optgroup label="{{$command->getName()}}">
37+
<optgroup label="{{$command->getDescription()}}">
3838
<option value="{{$command->getName()}}" {{old('command', $task->command) == $command->getName() ? 'selected' : ''}}>
39-
{{$command->getDescription()}}
39+
{{$command->getName()}}
4040
</option>
4141
</optgroup>
4242
@endforeach

src/Totem.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,12 @@ public static function getCommands()
7979
}
8080

8181
return $all_commands->sortBy(function (Command $command) {
82-
return $command->getDescription();
82+
$name = $command->getName();
83+
if (mb_strpos($name, ':') === false) {
84+
$name = ':'.$name;
85+
}
86+
87+
return $name;
8388
});
8489
}
8590

0 commit comments

Comments
 (0)