Skip to content

Conversation

oleole39
Copy link
Contributor

@oleole39 oleole39 commented Mar 24, 2025

The problem

As of YNH 12.1.3, if a custom getter in an app returns a multiline string, it will eventually get displayed in the config panel input box (e.g. in text box) as a single line string.

Solution

The proposed solution here is to change echo to echo -e in _ynh_app_config_show() helper so that it allows interpretation for newline characters.
Thus, multiline string output by the custom getter should be as such: line1\n\nline2\n\nline3 (single newline character is not enough, likely due to other layers of code (not investigated in this PR but which remind me of YunoHost/issues#2501).
That way it will get displayed in the config panel (tested for text input only) as:

line1
line2
line3

PR Status

Ready to merge as I don't believe it could impact negatively other custom getters.
Note that I am not very sure of when is actually triggered the portion of the modified helper after else instruction, maybe double newline would be too much here.

TODO: update the doc depending on whether that PR is accepted: https://doc.yunohost.org/en/packaging_config_panels

How to test

Cf. custom getter for marl_ynh config panel: https://github.com/YunoHost-Apps/marl_ynh/blob/31fbaad1c035630ed541361975c8af4d09025b8b/scripts/config#L76

You can install the app and then run yunohost app config get marl --full --debug to see whether YAML output includes multiline or singleline entry for archives_paths parameter.

@Salamandar
Copy link
Contributor

Actually that might break scripts that grep the output, as well as scripts that parse it as yaml.

@oleole39
Copy link
Contributor Author

Actually that might break scripts that grep the output, as well as scripts that parse it as yaml.

Not fully clear for me. You mean (some) apps scripts, right ? Would you have an example in mind ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants