-
-
Notifications
You must be signed in to change notification settings - Fork 480
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
Updated help output and removed extra logs from stdOut
option
#112
base: master
Are you sure you want to change the base?
Conversation
I reorganized, limited to 80 chars, added `--stdout`, added shortcut options, put a space between the path description to make it more readable, and also fixed ambiguous working in the stdOut function, as well as added periods.
e1f4d90
to
f76b8a6
Compare
@thlorenz I want to do another PR to remove the extra text for the |
@RichardLitt since this is all related to the output, we could probably combine the two. I assume you're gonna log on stderr to not clutter stdout, so stdout would only contain the output markdown right? |
@thlorenz How about that? Not sure about stderr -- where should that be applied, best? Thanks. |
stdOut
option
Basically any |
So to be clear, removing logs when using stdout option isn't a good idea, but to make things pipeable you just log them on stderr so they print when you do |
e7c24ef
to
ea7e404
Compare
Might need some help with this one. Tried to get it working in this change. What do you think? |
doctoc.js
Outdated
@@ -17,12 +17,12 @@ function cleanPath(path) { | |||
} | |||
|
|||
function transformAndSave(files, mode, maxHeaderLevel, title, notitle, entryPrefix, stdOut) { | |||
console.log('\n==================\n'); | |||
(stdOut) ? console.error('\n==================\n') : console.log('\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.
Almost, but ALWAYS log on console.error
not only if stdout
is used.
It's the correct thing to do either way when logging (mistake of my past self for not doing so in the first place ;) )
@RichardLitt commented in one place on the main idea. This applies for all the other places as well. Ideally you'd just take the original code and do a search replace |
ea7e404
to
c2b8a47
Compare
@thlorenz Ahh, got it. Pushed. Should be good? |
@thlorenz Ping! |
@thlorenz Any news on this? I still use this daily, and would love this change to be merged. :) |
It LGTM in general, sorry for the delay. |
I was pretty sure I had already done this; didn't #111 cover this? Why isn't this in the current package? |
Update: It is in the current package, not sure why I hadn't seen it before. Works with a fresh install. So, this is just an update of that. @thlorenz Do you still need the extra test? I don't see how that is different from the test I provided in #111 in transform-stdout.js. Happy to look again, though. There already is a section on |
@thlorenz hey! Just checking old PRs and saw this. What do you think? |
@thlorenz I'm curious. What have you moved onto? Do you still have a need to use this code, and are you still maintaining it? |
haven't moved on, just busy :) Also any clarification as to how things work should be noted in the readme (if there is a section already add to/modify it please) Thanks .. Also would like to have other collabs give their OK before we merge this (hopefully they see this). |
Updated! Let me know if this looks alright. |
Thanks, on first glance looks great. |
1 similar comment
Thanks, on first glance looks great. |
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.
Copilot reviewed 5 out of 6 changed files in this pull request and generated no suggestions.
Files not reviewed (1)
- lib/transform.js: Evaluated as low risk
Comments skipped due to low confidence (3)
doctoc.js:25
- The parameter name 'stdOut' is inconsistent with the typical naming convention. It should be renamed to 'stdout'.
result = transform(content, mode, maxHeaderLevel, title, notitle, entryPrefix, stdOut);
test/transform-stdout.js:17
- The error message 'spits out extra lines as errors' is unclear. It should be updated to 'stderr should contain extra lines as errors'.
t.deepEqual(stderr, fs.readFileSync(__dirname + '/fixtures/stderr.md', 'utf8'), 'spits out extra lines as errors')
test/transform-stdout.js:26
- The error message 'logs the correct table of contents' is unclear. It should be updated to 'stdout should contain the correct table of contents'.
t.deepEqual([ '- [Installation](#installation)', '- [API](#api)', '- [License](#license)', '' ].join('\n'), fs.readFileSync(__dirname + '/fixtures/stdout.md', 'utf8'), 'logs the correct table of contents')
@PeterDaveHello if you would like this PR to proceed, feel free to contribute, the merge conflicts will need to be resolved first. |
I reorganized, limited to 80 chars, added
--stdout
, added shortcut options, put a space between the path description to make it more readable, and also fixed ambiguous working in the stdOut function.