-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Feat: Added tabular markdown writer #1722
Conversation
…ation ✅ test(docs_test.go): add tests for generating tabular markdown documentation ✨ feat(template.go): add MarkdownTabularDocTemplate to generate a markdown table for command flags and environment variables
🐛 fix(fish_test.go): add EXAMPLE_VARIABLE_NAME to another-flag's EnvVars ✨ feat(template.go): add support for multiline UsageText in MarkdownTabularDocTemplate
…AppPath function ✨ feat(docs.go): add ToTabularToFileBetweenTags function to generate tabular markdown documentation and update file between tags 🔨 refactor(docs_test.go): update tests to use ToTabularMarkdown with appPath parameter instead of TabularOption ✅ test(docs_test.go): add tests for ToTabularToFileBetweenTags function
… support older Go versions
…g windows line endings
…ace function call to ignore windows line endings
🔥 refactor(docs_test.go): comment out unused windows line endings replacement
🐛 fix(docs_test.go): fix expected content type to byte array
🔥 refactor(docs_test.go): comment out unused code
✨ feat(docs_test.go): add normalizeNewlines function to normalize windows and mac newlines into unix newlines
…plicated code and improve readability
…g newlines in test
…g newlines in test
Friendly ping @meatballhat @dearchap @asahasrabuddhe @coilysiren |
@tarampampam To confess I am not a markdown expert so I cannot make some sense of the changes. It is going to take me some time unless one of the other @urfave/cli maintainers want to go ahead and comment |
Why it is called tabular? |
@tarampampam We would definitely like it to be merged since the display looks awesome. Can you give me a couple of days to review ? Thanks for your patience. |
…ion with invalid template.
…rMarkdown and remove TestToTabularMarkdownWithEmptyAppPath ✨ feat(docs_test.go): add subtests to TestToTabularMarkdown to test different scenarios 🔥 chore(docs_test.go): remove unused variable and restore MarkdownTabularDocTemplate after test
I have made all changes, requested by you. Hope you like the code now :) |
Thank you so much, guys! |
May I ask - how soon do you plan to release those changes? |
Usually there is a release every two weeks - https://github.com/urfave/cli/releases |
You can |
@abitrolly @dearchap It's been over three weeks and still no release :( |
I don't have money and I'm in de-pression to follow schedules. :D Let me try https://github.com/urfave/cli/blob/main/docs/RELEASING.md to see if I have enough privileges (and battery life) to do this. |
Okay. The problem is that the PR is in the I am now sure how version tracking works. Like what revision will you get, if you do That's all I could do for now. Need some clarifications from @meatballhat (#833 (comment)). |
There is two v3 tags now: |
@abitrolly sorry for my delay! I'm happy to tag a |
@abitrolly Done! Try |
@tarampampam ^^^ @jetexe so Go is able to figure out that |
What type of PR is this?
What this PR does / why we need it:
This PR allows to render of CLI usage docs in tabular markdown (
App.ToTabularMarkdown("app_name")
), with is pretty cool to use in the readme files.In addition, I've added a function named
ToTabularToFileBetweenTags
which provides an easy way to update the CLI usage help in the readme files. Users now only need to create a file (update_readme.go
):Add the following comment somewhere in the app code:
//go:generate go run update_readme.go
Plus put the following tags (which can be configured, of course) into the readme file:
And voila! After running
go generate ./...
the readme file will contain fresh CLI documentation, which will never become outdated because it is not handy-crafted.Co-authored with @jetexe
Which issue(s) this PR fixes:
Fixes #1721
Testing
I wrote all required unit tests.
Release Notes