Kara-Moon Forum
April 23, 2024, 11:57:18 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: You can go back to the main site here: Kara-Moon site
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Conflicting use of command line options  (Read 4108 times)
sciurius
Sr. Member
****
Posts: 443



« 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.
Logged
bvdp
Kara-Moon Master
****
Posts: 1437


WWW
« Reply #1 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 Smiley Just read and create things Smiley

 
Logged

My online life: http://www.mellowood.ca
sciurius
Sr. Member
****
Posts: 443



« Reply #2 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 Smiley .
Logged
bvdp
Kara-Moon Master
****
Posts: 1437


WWW
« Reply #3 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 Smiley .

Oh yeah ... the good old days. My little brain is already aching just looking at this Smiley
Logged

My online life: http://www.mellowood.ca
sciurius
Sr. Member
****
Posts: 443



« Reply #4 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'):
  
« Last Edit: December 31, 2018, 12:27:34 PM by sciurius » Logged
bvdp
Kara-Moon Master
****
Posts: 1437


WWW
« Reply #5 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.
Logged

My online life: http://www.mellowood.ca
sciurius
Sr. Member
****
Posts: 443



« Reply #6 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.
Logged
bvdp
Kara-Moon Master
****
Posts: 1437


WWW
« Reply #7 on: December 31, 2018, 06:52:01 PM »

Ahh, yet an another argument for github Smiley either that or shame on me for not doing more interm releases. See my new posting for great information!
Logged

My online life: http://www.mellowood.ca
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.046 seconds with 19 queries.