appliedgocode / goman

The missing man page for Go binaries. Goman fetches the repo's readme as a man page replacement.
Other
123 stars 3 forks source link

Readme has an unfinished sentence #2

Closed mholt closed 7 years ago

mholt commented 7 years ago

This point:

  • goman assumes that a command subproject is always in /cmd/. If the cmd dir has a different name, goman

is unfinished. :smile: I noticed after goman caddy yielded No README found for caddy at github.com/mholt/caddy/caddy. It doesn't follow the /cmd/ convention but now I really want to know what happens next! The suspense is killing me. ;) Will goman try to use the README at the top level folder?

Neat tool.

christophberger commented 7 years ago

Sorry, the statement wasn't suppose to create tension :)

goman searches for /cmd/ in the source path and strips the /cmd/... part away to find the main project if the /cmd/... folder does not contain a readme. Obviously this fails if the path to the command folder does not contain /cmd/, and goman then simply fails (as it does in the case of caddy).

I'll implement a different strategy then.

I think the best option is to recursively search the parent, grandparent, etc directories until a README is found or the root of the path is reached.

I'll implement this as soon as I can. I just cannot stand that goman fails just with my favorite Web server! :)

Am 27.06.2017 um 18:55 schrieb Matt Holt notifications@github.com:

This point:

goman assumes that a command subproject is always in /cmd/. If the cmd dir has a different name, goman is unfinished. 😄 I noticed after goman caddy yielded No README found for caddy at github.com/mholt/caddy/caddy. It doesn't follow the /cmd/ convention but now I really want to know what happens next! The suspense is killing me. ;) Will goman try to use the README at the top level folder?

Neat tool.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

mholt commented 7 years ago

I should have followed convention. :wink: Only hindsight can explain why I did not.

But I think that's not a bad idea, follow the directory tree up until you find a suitable README file.

christophberger commented 7 years ago

(Talking to myself) One problem with climbing up the dir tree is to figure out when to stop, especially when checking public repositories via HTTP. Going up to far would trigger needless "access denied" errors.

christophberger commented 7 years ago

Fixed by commit a9b958d605059104c05ac1c5039be0f51b6bd83c

goman now climbs the directory path until finding a README file. It does not make any assumptions about where exactly the project root is, so it may end up at top level (e.g. github.com/) if none of the directories in the path contain a readme file. The chances of this to happen should be fairly low, however.

mholt commented 7 years ago

Thanks! That'll do. It works. :)