#!/usr/bin/python3

### Copyright (C) 2013, 2022  Rafael Laboissière
###
### This program is free software; you can redistribute it and/or modify it
### under the terms of the GNU General Public License as published by the
### Free Software Foundation; either version 3 of the License, or (at your
### option) any later version.
###
### This program is distributed in the hope that it will be useful, but
### WITHOUT ANY WARRANTY; without even the implied warranty of
### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
### General Public License for more details.
###
### You should have received a copy of the GNU General Public License along
### with this program; if not, see <http://www.gnu.org/licenses/>.

import argparse
import subprocess

parser = argparse.ArgumentParser(description="Open sound files with Praat")
parser.add_argument ("--new", action="store_true",
                     help="Launch a new instance of praat for viewing the files")
parser.add_argument ("files", metavar="file", type=str, nargs="+",
                     help="sound file to be opened")

args = parser.parse_args()

print("This command is deprecated. Used either 'praat --open' or 'praat --new-open'")

command = ["praat", "--new-open" if args.new else "--open"]
command.extend(args.files)
subprocess.Popen(command)
