You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have 53 commands overwriting completeArgumentValues from the Base command in the "managed" apps.
Future native symfony
However since symfony/console 6.4 there is a new autocomplete built-in directly.
Instead of a completion function on the command, you give one on each argument or option.
My idea now would be that we officially deprecate the old style (we can continue to ship the classes so they don't break existing apps if missing).
The only downside I noticed is that the current tool allows to give a program name, which basically allows to autocomplete on aliases for occ out of the box, while on symfony one must manually edit the last line of the output, but that can also be documented
Easy of use for developers
Since it's much easier now, I'd also suggest that we add OCPs for some wide spread completes, which apps can then easily refer to by OCP\Command\Completion::completeUserId(...) and things a like. Most valuable completes are:
A way to remind devs to use autocomplete. Maybe psalm check or something could be written that forces completion to be defined, at least for some well known options/arguments like user/uid/userid/group/gid/groupid/…
Why? Because there is no reason why e.g.
should not assist the admin to autocomplete the user, especially when it's only about adding suggestedValues: Completion::completeUserId(...) going forward.
Until now
stecman/symfony-console-completionSince a long time we are shipping https://github.com/stecman/symfony-console-completion to help with autocompletion of commands, arguments and options.
We have 53 commands overwriting
completeArgumentValuesfrom the Base command in the "managed" apps.Future native symfony
However since symfony/console 6.4 there is a new autocomplete built-in directly.
Instead of a completion function on the command, you give one on each argument or option.
My idea now would be that we officially deprecate the old style (we can continue to ship the classes so they don't break existing apps if missing).
The documentation should also be adjusted:
https://docs.nextcloud.com/server/latest/admin_manual/occ_command.html#enabling-autocompletion
The only downside I noticed is that the current tool allows to give a program name, which basically allows to autocomplete on aliases for occ out of the box, while on symfony one must manually edit the last line of the output, but that can also be documented
Easy of use for developers
Since it's much easier now, I'd also suggest that we add OCPs for some wide spread completes, which apps can then easily refer to by
OCP\Command\Completion::completeUserId(...)and things a like. Most valuable completes are:I started a draft in feat(commands): Migrate to symfony console completion #63792
Follow-up idea: Enforce completion
A way to remind devs to use autocomplete. Maybe psalm check or something could be written that forces completion to be defined, at least for some well known options/arguments like user/uid/userid/group/gid/groupid/…
Why? Because there is no reason why e.g.
server/apps/dav/lib/Command/ClearCalendarUnshares.php
Lines 49 to 53 in d8e8703
suggestedValues: Completion::completeUserId(...)going forward.Request for comments
From anyone providing commands and @CarlSchwan @come-nc @ChristophWurst