Set Foo user in Bar Group and as Admin of Bar Group with occ cmd

Hi,
In my nextcloud environement, using the OCC cmds I have created an group named Bar (GID => BAR).
In this group, i ve added a user named Foo (UID => Foo).
That’s part is fine.

Now i would like to set the Foo user as the admin of the Bar Group. But i saw nothing to do that.

In the web interface it’s possible to set the Foo user as the admin of the bar group, but i really need to do that with the occ cmd.

Any idea?

sudo -u www-data php occ group:add bar
su -s /bin/sh www-data -c 'php occ user:add --password-from-env --display-name="FooFoo" --group="bar" foo'

Thx

EDIT :
My ugly solution is to use the api :

curl -X POST https://admin:admin@my_server/nextcloud/ocs/v1.php/cloud/users/foo/subadmins -d groupid="bar" -H "OCS-APIRequest: true"

Yes i know, that’s an ugly one…

Nextcloud 19

Benoît