Skip to content
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

Click help text formatting sugestion #361

Closed
winxp5421 opened this issue Nov 29, 2022 · 4 comments
Closed

Click help text formatting sugestion #361

winxp5421 opened this issue Nov 29, 2022 · 4 comments

Comments

@winxp5421
Copy link

Click help text formatting when it is posted to mattermost can be very messy.
I have tried changing the click context settings for terminal size, etc. in an attempt to make the output more appealing to the human eye but, ultimately the most straightforward fix I have found is wrapping the help output in a message code block ```

I changed this which seemed to do the trick but, unsure if this was the most graceful way to handle this.
function.py:171 return self.plugin.driver.reply_to(message, f"{e}\n```\n{self.docstring}\n```")

Anyway, please consider adding.

Thanks!

@unode
Copy link
Collaborator

unode commented Nov 29, 2022

Hi @winxp5421,

Thanks for the suggestion. We are aware that click's help output is not the most useful due to being designed for command-line usage.

Alternatively you can use regex based commands and human_description and category for a cleaner help text:

@listen_to(
    "^add-element +(?P<identifier>[\\w-]+) +[~]?(?P<channel>[\\w-]+) +(?P<url>[^\\s]+)(?: (?P<sensitive_url>[Yy]{1}))?",
    allowed_users=settings.PRIVILEGED_USERS,
    human_description="add-element <identifier> <channel> <url> [sensitive_url=Y/N]",
    category="announce",
    privileged=True,
)

@winxp5421
Copy link
Author

Interesting, I will give that a shot.

Will mmpy-bot be dropping click support sometime in the near future?
I do not want to stick a ton of time into click-related stuff if this will be sunset in a few months' time.

Appreciate the suggestion!

@unode
Copy link
Collaborator

unode commented Nov 29, 2022

Me and @attzonko discussed this briefly in the Discord chat. Click is an interesting feature but has some limitations that are a little annoying and difficult to work around. We won't be removing it anytime soon but it's possible that we will deprecate it if we find or implement a good alternative.

@winxp5421
Copy link
Author

@unode Thank you for your time!
I will close this issue out.

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

No branches or pull requests

2 participants