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

[SM-1097] Add support for manpage generation #175

Merged
merged 7 commits into from
May 1, 2024
Merged

Conversation

dani-garcia
Copy link
Member

@dani-garcia dani-garcia commented Aug 21, 2023

Type of change

- [ ] Bug fix
- [x] New feature development
- [ ] Tech debt (refactoring, code cleanup, dependency upgrades, etc)
- [ ] Build/deploy pipeline (DevOps)
- [ ] Other

Objective

Implement support for generating manpages at compile-time. Extracted from PR #103. The manpages also get generated in CI and uploaded as artifacts.

Note that because the CLI struct needs to be accessed by a build script, it had to be extracted to a separate self contained file.

How to generate manpages locally

The manpages get generated by a build script, and are available in the crate's build script OUT_DIR, to get it:

cargo build --message-format json > build.json
jq -r --slurp '.[] | select (.reason == "build-script-executed") | select(.package_id|contains("crates/bws")) .out_dir' build.json

The output path is going to be something like sdk/target/debug/build/bws-4acb75a675879df1/out.

Copy them to a better location, and then you can view the pages:

  • man ./my-pages/bws.1
  • man ./my-pages/bws-project.1
  • man ./my-pages/bws-secret.1

If you install them in a system path, you could also just access them with man bws, but that path is system specific. In Ubuntu I think it is /usr/share/man

Screenshots

Screenshot 2023-07-14 at 18 28 54

image

@Hinton
Copy link
Member

Hinton commented Nov 2, 2023

I think we should switch to generating manpages in the CI and possibly have them be a release artifact? Realistically they are only going to be used if we start distributing linux packages for the CLI.

Base automatically changed from complete_and_manpages to master November 14, 2023 19:29
@Hinton Hinton changed the title Add support for manpage generation [PM-6106] Add support for manpage generation Feb 6, 2024
@Hinton Hinton changed the title [PM-6106] Add support for manpage generation [SM-1097] Add support for manpage generation Feb 6, 2024
Copy link
Contributor

github-actions bot commented Apr 3, 2024

Logo
Checkmarx One – Scan Summary & Detailsafc50ec8-e11f-4135-952a-0b5c194061b6

No New Or Fixed Issues Found

Copy link

codecov bot commented Apr 3, 2024

Codecov Report

Attention: Patch coverage is 12.90323% with 27 lines in your changes are missing coverage. Please review.

Project coverage is 60.67%. Comparing base (21ad6b2) to head (a0b8031).
Report is 1 commits behind head on main.

Files Patch % Lines
crates/bws/src/cli.rs 0.00% 27 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #175      +/-   ##
==========================================
+ Coverage   60.66%   60.67%   +0.01%     
==========================================
  Files         173      174       +1     
  Lines       10628    10631       +3     
==========================================
+ Hits         6447     6450       +3     
  Misses       4181     4181              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@dani-garcia dani-garcia marked this pull request as draft April 4, 2024 14:57
@dani-garcia dani-garcia marked this pull request as ready for review April 4, 2024 15:30
@dani-garcia dani-garcia requested a review from a team as a code owner April 4, 2024 15:30
@dani-garcia dani-garcia requested a review from Hinton April 4, 2024 15:30
Hinton
Hinton previously approved these changes Apr 5, 2024
# Conflicts:
#	crates/bws/src/config.rs
coltonhurst
coltonhurst previously approved these changes Apr 8, 2024
Copy link
Member

@coltonhurst coltonhurst left a comment

Choose a reason for hiding this comment

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

@dani-garcia approved above, thanks for this! Something I just thought of...

One potential thing to add if you were open to it- adding the instructions you have in this PR for the compile time man pages to crates/bws/README.md?

Hinton
Hinton previously approved these changes Apr 9, 2024
# Conflicts:
#	crates/bws/Cargo.toml
#	crates/bws/src/main.rs
#	crates/bws/src/render.rs
@dani-garcia dani-garcia dismissed stale reviews from Hinton and coltonhurst via 6fa7bf9 April 15, 2024 09:31
Copy link

@urbinaalex17 urbinaalex17 left a comment

Choose a reason for hiding this comment

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

The manpage support and pipeline changes look good! 👍🏻

@dani-garcia dani-garcia merged commit 643d40c into main May 1, 2024
80 checks passed
@dani-garcia dani-garcia deleted the ps/manpage_support branch May 1, 2024 16: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.

4 participants