]> git.donarmstrong.com Git - lilypond.git/commitdiff
lys-to-tely.py: add --glob-input=
authorGraham Percival <graham@percival-music.ca>
Tue, 30 Aug 2011 03:53:11 +0000 (04:53 +0100)
committerGraham Percival <graham@percival-music.ca>
Tue, 30 Aug 2011 03:53:11 +0000 (04:53 +0100)
This will let us avoid the "too many arguments" without needing to
sepcify all names on the command-line.

scripts/build/lys-to-tely.py

index a911e02aa2e02d5b99b42b21476f65b0eee62046..6a2a05ed7df95cc524222b72f7c61e58fbe67b96 100644 (file)
@@ -14,6 +14,7 @@ import sys
 import os
 import getopt
 import re
+import glob
 
 program_name = 'lys-to-tely'
 
@@ -28,6 +29,7 @@ Options:
    options
  -o, --output=NAME              write tely doc to NAME
  -i, --input-filenames=NAME     read list of files from a file instead of stdin
+ -g, --glob-input=GLOB          a string which will be passed to glob.glob(GLOB)
  -t, --title=TITLE              set tely doc title TITLE
  -a, --author=AUTHOR            set tely author AUTHOR
      --template=TEMPLATE        use TEMPLATE as Texinfo template file,
@@ -43,12 +45,13 @@ def help (text):
 (options, files) = getopt.getopt (sys.argv[1:], 'f:hn:t:',
                      ['fragment-options=', 'help', 'name=',
                      'title=', 'author=', 'template=',
-                     'input-filenames='])
+                     'input-filenames=', 'glob-input='])
 
 name = "ly-doc"
 title = "Ly Doc"
 author = "Han-Wen Nienhuys and Jan Nieuwenhuizen"
 input_filename = ""
+glob_input = ""
 template = '''\input texinfo
 @setfilename %%(name)s.info
 @settitle %%(title)s
@@ -90,6 +93,8 @@ for opt in options:
         author = a
     elif o == '-i' or o == '--input-filenames':
         input_filename = a
+    elif o == '-p' or o == '--glob-input':
+        glob_input = a
     elif o == '-f' or o == '--fragment-options':
         fragment_options = a
     elif o == '--template':
@@ -143,7 +148,9 @@ def name2line (n):
 """ % (os.path.basename (n), fragment_options, n)
     return s
 
-if input_filename:
+if glob_input:
+    files = glob.glob(glob_input)
+elif input_filename:
     files = open(input_filename).read().splitlines()
 
 if files: