New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use getops #561
Use getops #561
Conversation
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. |
There's no reason in that loop where we're looking for values of an option to have a blank cell in the array of arguments. Unless for an option with a missing value. In that case, it's better to ignore this condition and store a blank value in the variable. Otherwise, in case of missing value for an option, with this condition, we enter in an infinite loop, because the shift will stay at 0.
I guess now the code is stable enough to really starting to test the helpers... |
Many core backup script source /usr/share/yunohost/helpers.d/filesystem only. Not sure it's a wonderful idea...
I've tested most of the helpers with an app and package check, without any errors. |
#455 has been merged in unstable a few hours ago. So, please this PR needs reviews. |
Uh I didn't realize that ... Maybe we can revert and reopen #455 then ? Or merge only the new getopts file from this PR ... I'm a bit unconfortable with merging all this PR considering the number of changes and that the goal is to go for a stable on ~Tuesday |
I'll make another PR to fix ynh_handle_getopts_args then. |
Yup, same 👍 |
@YunoHost/apps |
So do we agree to merge this as is to run tests via the C.I ? 😉 |
This is a great piece of work, and while I haven't tested it myself, it's totally LGTM! 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
Yep, would be great ! |
The problem
getopts is now available for all our official helpers
Solution
Migrate all our helpers to getopts
PR Status
How to test
Although it's not finished, I'm not going to go back unless there's an error to fix.
So don't hesitate to help by testing the helpers.
To test, replace the official helpers by this version. (/usr/share/yunohost/helpers.d/)
Validation