-
Notifications
You must be signed in to change notification settings - Fork 110
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
added feature synth-doc #99
base: master
Are you sure you want to change the base?
Conversation
On a cursory glance, this looks good. I'll have to test run it, and we'll need to rebase before merging though. I'll let you know when I've done the test run. |
Just let me know what I need to do after you test run it. If changes need to be made, I'll make them and rebase on master. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I tested this and looked at the output. It's not perfect yet, but a very decent start. The biggest change I'd like to see would be tables for the fields. I'd also like to see less header depths. Otherwise it's just a few nitpicks.
synth/src/cli/synth_doc.rs
Outdated
} | ||
|
||
fn write_colls(ns: &Namespace, file: &mut BufWriter<File>) -> Result<()> { | ||
writeln!(file, "```text\n### Description\n\n\n\n\n```")?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This "```text" makes the whole thing a code block. I don't think that's right here. Also below the Description
header there should be a (please enter a descriptive text here)
or some such.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. I'll fix this. Thanks.
synth/src/cli/synth_doc.rs
Outdated
}; | ||
Ok(()) | ||
} | ||
fn write_coll_details((name, content ): (&Name,&Content), file: &mut BufWriter<File>) -> Result<()>{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We usually have spaces after commas. Perhaps cargo fmt
the whole thing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure!
synth/src/cli/synth_doc.rs
Outdated
write_foreigns((&name, &object_content), file)?; | ||
} | ||
Content::Object(obj) => { | ||
writeln!(file, "##### Fields")?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
5-level subheadings are clearly too far. We should remove one or two levels overall.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand. I should probably keep it at three
synth/src/cli/synth_doc.rs
Outdated
writeln!(file, "##### {} [Type: *Null*]", name)?; | ||
writeln!(file, "> Description goes here: ")?; | ||
writeln!(file, "")?; | ||
writeln!(file, "")?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no need to have multiple writeln!
calls here:
writeln!(file, "##### {} [Type: *Null*]", name)?; | |
writeln!(file, "> Description goes here: ")?; | |
writeln!(file, "")?; | |
writeln!(file, "")?; | |
writeln!(file, "##### {} [Type: *Null*]\n> Description goes here: \n\n", name)?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh.. No need? I'll do that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll write it all once as a single formatted string
synth/src/cli/synth_doc.rs
Outdated
writeln!(file, "##### {} [Type: *{}*]", name, content.kind())?; | ||
writeln!(file, "> Description goes here: ")?; | ||
writeln!(file, "")?; | ||
writeln!(file, "")?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
synth/src/cli/synth_doc.rs
Outdated
writeln!(file, "##### {} [Type: *{}*]", name, content.kind())?; | ||
writeln!(file, "> Description goes here: ")?; | ||
writeln!(file, "**Variants:**")?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And here.
In response to #31 , I'm submitting this Pull request.
I chose not to use another dependency as the crates currently available are not easily adaptable to my use case.
I included a new command in the cli.
Please check, @llogiq
Thank you!!