You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
for man ingen_manuals(&app){let name = "clap-man-demo.1";// FIXME: Extract this from man!let path = PathBuf::from(&outdir).join(name);letmut out = fs::File::create(&path).unwrap();
out.write_all(man.render().as_bytes()).unwrap();}
Proposed
for man ingen_manuals(&app){let path = PathBuf::from(env!("CARGO_PKG_NAME")).push(man.path());
fs::write(path, man.render())?;}
The text was updated successfully, but these errors were encountered:
Introduce render_to which accepts a W: Writer directly instead of allocating a string internally.
for man ingen_manuals(&app){let path = PathBuf::from(env!("CARGO_PKG_NAME")).push(man.path());
man.render_to(fs::File::create(&path)?)?;}
This is more work and it will only be really useful if we manage to add a similar API to our roff crate (not that hard), too; rroff already works like this internally.
@killercup oh I like that a lot! - I reckon if we go with your approach, we should also introduce a method to at least have access to the name. E.g. so if people choose to go with a deviating approach (for whatever reason) at least the basic requirements are available to them.
Applies to #10. Per https://github.com/killercup/clap-man-demo/blob/master/build.rs#L17-L19, we should have a method to generate a file name.
API
Current
Proposed
The text was updated successfully, but these errors were encountered: