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

Add detection for zsh completion files #1933

Merged
merged 4 commits into from
May 15, 2023
Merged

Conversation

griano
Copy link
Contributor

@griano griano commented Mar 9, 2023

Chenges

  • In ZSH completions files start with #compdef and #autoload, like these files
  • I also added detection for some typical ZSH env files.

Testing

  • rake passes all tests
  • Example with #autoload
$ ./bin/rougify guess =(curl -sq https://github.com/zsh-users/zsh/blob/master/Completion/Base/Utility/_arguments)
{ tag: "html", title: "HTML", desc: "HTML, the markup language of the web" }
  • Example with #compdef
$ ./bin/rougify guess =(curl -sq https://github.com/zsh-users/zsh/blob/master/Completion/Zsh/Command/_alias)                                                                               
{ tag: "html", title: "HTML", desc: "HTML, the markup language of the web" }

Copy link
Collaborator

@tancnle tancnle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution @griano ❤️ I have a small suggestion for your consideration.

Additionally, would it be possible if you can add some tests for the new guessing logic? You can find some existing examples here. Let me know if you need any assistance.

lib/rouge/lexers/shell.rb Outdated Show resolved Hide resolved
lib/rouge/lexers/shell.rb Outdated Show resolved Hide resolved
@tancnle tancnle added the author-action The PR has been reviewed but action by the author is needed label May 14, 2023
@tancnle
Copy link
Collaborator

tancnle commented May 15, 2023

Thank you for considering the suggestions, @griano. The change LGTM 🚀

@tancnle tancnle added this pull request to the merge queue May 15, 2023
Merged via the queue into rouge-ruby:master with commit 0255a0e May 15, 2023
7 checks passed
@griano
Copy link
Contributor Author

griano commented May 15, 2023

Addressed the requested changes.

Testing:

The test above were reported incorrectly. In these tests I use the raw URL to download the actual file.

Test with #autoload

$ bin/rougify guess <(curl -sq https://raw.githubusercontent.com/zsh-users/zsh/master/Completion/Base/Utility/_arguments) 
{ tag: "shell", title: "shell", desc: "Various shell languages, including sh and bash" }

Test with `#compdef``

$ bin/rougify guess <(curl -qs https://raw.githubusercontent.com/zsh-users/zsh/master/Completion/Zsh/Command/_alias)
{ tag: "shell", title: "shell", desc: "Various shell languages, including sh and bash" }
```bash

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author-action The PR has been reviewed but action by the author is needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants