Add --help option to abcplay.py.
authorW. Trevor King <wking@drexel.edu>
Wed, 17 Nov 2010 01:37:15 +0000 (20:37 -0500)
committerW. Trevor King <wking@drexel.edu>
Wed, 17 Nov 2010 01:37:15 +0000 (20:37 -0500)
posts/abcplay/abcplay.py

index 8f76f03813adacc1b83d9e896fe1d99f14e2aaea..2083edd99ca442680ac013a46ea9dd28d4db1552 100755 (executable)
 # License along with this program.  If not, see
 # <http://www.gnu.org/licenses/>.
 
+"""Play ABC_ files using abc2midi_ and timidity_.
+
+For example::
+
+    abcplay.py my_collection.abc:3:7:8 another_collection.abc
+
+SIGINT (usually ^C) will kill the current tune and proceed the next
+one.  Two SIGINTs in less than one second will kill the abcplay.py
+process.
+
+.. _abc2midi: http://abc.sourceforge.net/abcMIDI/
+.. _timidity: http://timidity.sourceforge.net/
+"""
+
 from subprocess import Popen
 from tempfile import mkstemp
 from time import time
@@ -92,6 +106,14 @@ class ABCPlayer (object):
 
 if __name__ == '__main__':
     import sys
+    import optparse
+
+    usage = '%prog file[:refnum[:refnum:...]] ...'
+    epilog = __doc__
+    p = optparse.OptionParser(usage=usage, epilog=epilog)
+    p.format_epilog = lambda formatter: epilog+'\n'
+    options,args = p.parse_args()
+    del p
 
     p = ABCPlayer()
     try: