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

Feat: support def gen-doc command #5975

Merged
merged 3 commits into from
May 12, 2023
Merged

Conversation

iyear
Copy link
Contributor

@iyear iyear commented May 10, 2023

Description of your changes

πŸ€– Generated by Copilot at f9b3899

Summary

πŸ› οΈπŸ“πŸ“š

This pull request enhances the cli package with new features and tests for definition generation. It adds a vela def gen-doc subcommand to create markdown files from cue definitions, and refactors the code and constants for cue and markdown generation. It also improves the test coverage for the definition commands in def_test.go.

vela def gen-doc
New subcommand for cue files
Autumn of refactoring

Walkthrough

  • Rename NewDefinitionGenDocCommand function to NewDefinitionDocGenCommand and update its comment and usage (link, link, link)
  • Extract and rename constant genTypeProvider for the type flag value of gen-cue and gen-doc subcommands (link)
  • Replace literal string provider with constant genTypeProvider in NewDefinitionGenCUECommand function (link, link)
  • Add constant providerTestDataPath for the relative path to the provider testdata directory (link)
  • Add NewDefinitionGenDocCommand function to create vela def gen-doc subcommand for generating documentation for provider definitions (link)
    • Import io and docgen packages for reading cue files and generating markdown output (link, link)

Part of #5364

Preview:

$ ./vela def gen-doc -h
Generate documentation for non component, trait, policy and workflow definitions

Usage:
  vela def gen-doc [flags] SOURCE.cue...

Examples:
1. Generate documentation for provider definitions
> vela def gen-doc -t provider provider1.cue provider2.cue > provider.md

Flags:
  -h, --help          help for gen-doc
  -t, --type string   Type of the definition to generate. Valid types: [provider]

Global Flags:
  -y, --yes   Assume yes for all user prompts

I have:

  • Read and followed KubeVela's contribution process.
  • Related Docs updated properly. In a new feature or configuration option, an update to the documentation is necessary.
  • Run make reviewable to ensure this PR is ready for review.
  • Added backport release-x.y labels to auto-backport this PR if necessary.

How has this code been tested

Special notes for your reviewer

Signed-off-by: iyear <ljyngup@gmail.com>
Signed-off-by: iyear <ljyngup@gmail.com>
@codecov
Copy link

codecov bot commented May 10, 2023

Codecov Report

Patch coverage has no change and project coverage change: -0.04 ⚠️

Comparison is base (761c308) 60.55% compared to head (74afb62) 60.51%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5975      +/-   ##
==========================================
- Coverage   60.55%   60.51%   -0.04%     
==========================================
  Files         224      224              
  Lines       31202    31202              
==========================================
- Hits        18895    18883      -12     
- Misses      10525    10538      +13     
+ Partials     1782     1781       -1     
Flag Coverage Ξ”
core-unittests 55.78% <ΓΈ> (-0.05%) ⬇️
e2e-multicluster-test 24.68% <ΓΈ> (+<0.01%) ⬆️
e2etests 25.14% <ΓΈ> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

see 6 files with indirect coverage changes

β˜” View full report in Codecov by Sentry.
πŸ“’ Do you have feedback about the report comment? Let us know in this issue.

Signed-off-by: iyear <ljyngup@gmail.com>
@Somefive Somefive merged commit e5b9dca into kubevela:master May 12, 2023
22 checks passed
@iyear iyear deleted the feat/gen-doc-cmd branch May 15, 2023 09:33
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.

None yet

2 participants