-
-
Notifications
You must be signed in to change notification settings - Fork 96
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
Implement option length selection with options and environment variables #259
base: main
Are you sure you want to change the base?
Conversation
Related issue tldr-pages/tldr#13556 |
Seems interesting. Does this always hold up with all instances of What would you envision the CLI to look like for |
tldr.py
Outdated
@@ -478,6 +478,13 @@ def emphasise_example(x: str) -> str: | |||
line = line.replace(r'\{\{', '__ESCAPED_OPEN__') | |||
line = line.replace(r'\}\}', '__ESCAPED_CLOSE__') | |||
|
|||
# Extract long or short options from placeholders | |||
if not (shortform and longform): |
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.
Default would obiously be True for both so that this condition causes a skip. I'm not certain what you're asking in the rest of the comment.
What about tools that don't follow this convention for short and long options (e.g. tldr-pages/tldr#13556 (comment))? |
If a tool doesn't follow this convention then it won't be affected by this. Simple as that. |
This regular expression won't work if there are multiple short options in a single placeholder. `rsync {{-zvhP|--compress --verbose --human-readable --partial --progress}} {{path/to/source}} {{path/to/destination}}` |
That is by design. Like I said in the original issue, the initial implementation should be as strict as possible. EDIT: However. That example is pretty nice for condensing the shortform options. Maybe I should allow it to be picked up. |
Alright, I'm looking for feedback again. Is this the proper way to implement options? Also how can I implement TLDR_SHORTFORM and TLDR_LONGFORM env variables? |
Nvm figured it out. Now I'm just looking for feedback. |
Initial ideas on how to implement the shortform/longform print modes.