cargo-readme icon indicating copy to clipboard operation
cargo-readme copied to clipboard

Workspace usage error

Open emilk opened this issue 5 years ago • 2 comments

When I try to use cargo readme in a workspace directory I get this error:

Error: missing field path for key lib at line 23 column 1

I have a workspace with many crates in it, and I'd like to generate individual README.mds for each one. I've tried both:

  • cargo readme -r subcrate > subcrate/README.md
  • (cd subcrate ; cargo readme > README.md)

With the same error message.

This is the workspace: https://github.com/emilk/egui/

emilk avatar Jan 17 '21 09:01 emilk

I encountered this same error message when I had a [lib] section that did not contain an explicit path = "src/lib.rs". Removing the entire [lib] section or adding path both circumvented this error.

jedbrown avatar May 28 '21 05:05 jedbrown

I ran into the same issue.. I used a pre-commit hook to fix it with this code:

# Get the root directory
BASE=$(git rev-parse --show-toplevel)

# Update README.md
pushd $BASE/h2gb > /dev/null

# Do the main README.md
cargo readme -o $BASE/README.md

But it would be nice if it could cleanly handle workspaces!

iagox86 avatar Sep 29 '21 20:09 iagox86