Title: Conflicting use of command line options Post by: sciurius on December 29, 2018, 08:49:38 PM Try
mma - < mysong.mma This produces the error message "Input from STDIN specified. Use -f to set an output filename." Understandable. But what if we do not generate output? mma -n - < mysong.mma I'd say this is legal, even useful. But mma throws a Usage error. Title: Re: Conflicting use of command line options Post by: bvdp on December 29, 2018, 10:17:19 PM This works:
mma -f /dev/null - <test.mma And, actually, I think it's a bug. Try changing the following: 1. main.py, line 125: ###################################### # Create the output filename if not MMA.debug.noOutput: MMA.paths.createOutfileName(".mid") 2. options.py, line 265: # if a single '-' is left on the cmd line user want stdin. We set the # the input filename to numeric 1 which can't be entered. if gbl.infile == '-': gbl.infile = 1 if not gbl.outfile and not(MMA.debug.noOutput): error("Input from STDIN specified. Use -f to set an output filename.") Did a quick test here and it seems to work. Honestly, I've never had a need for stdin or for no output :) Just read and create things :) Title: Re: Conflicting use of command line options Post by: sciurius on December 30, 2018, 08:58:24 AM Thanks. I use this feature quite often during experiments for things like
echo printchord m7 | mma -n - echo printactive | cat t.mma - | mma - But I know, I'm an old fashioned command line scripter :) . Title: Re: Conflicting use of command line options Post by: bvdp on December 30, 2018, 10:12:06 PM Thanks. I use this feature quite often during experiments for things like echo printchord m7 | mma -n - echo printactive | cat t.mma - | mma - But I know, I'm an old fashioned command line scripter :) . Oh yeah ... the good old days. My little brain is already aching just looking at this :) Title: Re: Conflicting use of command line options Post by: sciurius on December 31, 2018, 11:23:21 AM And, actually, I think it's a bug. Try changing the following: Still get errors. Shouldn't there be a case in opts() to actually handle the -n?E.g. line 79 in parse.py: elif o in ('-d', '-o', '-p', '-s', '-r', '-e', '-c' , '-n'): Title: Re: Conflicting use of command line options Post by: bvdp on December 31, 2018, 04:30:37 PM No. The -n is handled by the debug code.
Line 80 of options.py: elif o in ('-d', '-o', '-p', '-s', '-r', '-w', '-n', '-e', '-c'): MMA.debug.cmdLineDebug(o[-1]) Check later today for the latest version. Title: Re: Conflicting use of command line options Post by: sciurius on December 31, 2018, 05:59:03 PM My mistake... I did intend to refer to options.py but accidentally mentioned parse.py.
In any case, it is clear that the handling of -n is not in the 16.06b sources and apparently you fixed it already in yours. Title: Re: Conflicting use of command line options Post by: bvdp on December 31, 2018, 06:52:01 PM Ahh, yet an another argument for github :) either that or shame on me for not doing more interm releases. See my new posting for great information!
|