Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Use getops #561
getopts is now available for all our official helpers
Migrate all our helpers to getopts
How to test
Although it's not finished, I'm not going to go back unless there's an error to fix.
To test, replace the official helpers by this version. (/usr/share/yunohost/helpers.d/)
I tried to test with a full replacement of the helpers.
Here my errors so far, for those who want to try as well.
Finally found the error with mysql, and that's bigger than I thought it would be...
In ynh_mysql_setup_db, the array is set that way:
Most of the time, for other helpers, the array will be set as:
But, during my tests, the array is set that way
That's not a problem when using getopts parameters, because we're using the key, n, p or u to access the array. But, when using the legacy mode, there's no way to know which argument is supposed to match which option, unless by using arguments in the same order than the array.
This issue will need to rethink a part of the legacy mode, and also to add a variable in the helper that call ynh_handle_getopts_args to fix that order in a strict way.