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

new: Display example usage in command help pages #567

Merged
merged 1 commit into from
Jan 9, 2024

Conversation

lgarber-akamai
Copy link
Contributor

@lgarber-akamai lgarber-akamai commented Jan 8, 2024

📝 Description

This pull request adds a new Example Usage section to generated command help pages. These examples are pulled from the x-code-samples OpenAPI spec extension.

This functionality was previously implemented before the spec parser rework (#299, #303) but was never merged. Thanks @bavedarnow and @Dorthu for the original idea and implementations!

Closes #299, #303

📷 Preview

linode-cli_–_operation_py

✔️ How to Test

The following testing instructions assume you have pulled down this change and run make install.

Running unit tests:

make testunit

Manual testing:

  1. View the help page for the linodes create (POST) command:
linode-cli linodes create --help
  1. Observe the Example Usage section displays as expected.
  2. View the help page for the linodes view (GET) command:
linode-cli linodes view --help
  1. Observe the Example Usage section displays as expected.
  2. View the help page for the linodes update (PUT) section.
linode-cli linodes update --help
  1. Observe the Example Usage section displays as expected.
  2. View the help page for the linodes delete (DELETE) section.
linode-cli linodes delete --help
  1. Observe the Example Usage section displays as expected.

@lgarber-akamai lgarber-akamai requested a review from a team as a code owner January 8, 2024 17:33
@lgarber-akamai lgarber-akamai requested review from jriddle-linode and yec-akamai and removed request for a team January 8, 2024 17:33
@@ -8,4 +8,3 @@ requests-mock==1.11.0
boto3-stubs[s3]
build>=0.10.0
twine>=4.0.2
packaging>=23.2
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was already defined in requirements.txt 👍

Copy link
Contributor

@yec-akamai yec-akamai left a comment

Choose a reason for hiding this comment

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

Nice work! Example usages are shown as expected 🎉

Copy link
Collaborator

@jriddle-linode jriddle-linode left a comment

Choose a reason for hiding this comment

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

LGTM! Documentation as a Service.

@lgarber-akamai lgarber-akamai merged commit ccefff3 into linode:dev Jan 9, 2024
6 checks passed
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.

3 participants