qrush / sub

a delicious way to organize programs
http://37signals.com/svn/posts/3264-automating-with-convention-introducing-sub
MIT License
1.74k stars 148 forks source link

Auto Documenting Syntax For Node Commands #36

Closed derekr closed 3 years ago

derekr commented 11 years ago

Not quite sure how to tap in to the auto documentation when creating a node based command. Hash bangs are illegal characters and js comments aren't picked up by sub.

Tried:

#!/usr/bin/env node
// # Usage: diy notify
// # Summary: Send a notification to any maker.
// # Help: Be careful!

and

#!/usr/bin/env node
// Usage: diy notify
// Summary: Send a notification to any maker.
// Help: Be careful!
jdevera commented 11 years ago

You can work around this by having a shell script to be the actual command (sub-something) with all the metadata and then just call

exec something.js "$@"

to call the node command. I do something similar for binary (compiled code) commands.

jacobthemyth commented 9 years ago

I just use block comments:

#!/usr/bin/env node
/*
# Usage: diy notify
# Summary: Send a notification to any maker.
# Help: Be careful!
*/
markstos commented 6 years ago

This can be closed. The suggestion by @iakobos is simple, intuitive and works.

qrush commented 3 years ago

👁️ Catching up here after a long time off... I'd love a PR to allow for parsing comments in different languages. Can close this for now though.