Fix --stdout
This commit is contained in:
parent
3a709aa4d6
commit
310743a498
|
@ -60,8 +60,7 @@ An example of calling the program from Python:
|
||||||
```
|
```
|
||||||
import fsub
|
import fsub
|
||||||
|
|
||||||
# Pass the arguments here
|
fsub.run('-c', 'test.srt')
|
||||||
fsub.run(['-c', 'test.srt'])
|
|
||||||
```
|
```
|
||||||
|
|
||||||
# Features
|
# Features
|
||||||
|
|
|
@ -2,5 +2,5 @@ import fsub.fsub as fsub
|
||||||
|
|
||||||
|
|
||||||
# External interface
|
# External interface
|
||||||
def run(args):
|
def run(*args):
|
||||||
fsub.run(args)
|
fsub.run(args)
|
||||||
|
|
|
@ -303,7 +303,7 @@ class SubripFile:
|
||||||
|
|
||||||
self.subs = new_subs
|
self.subs = new_subs
|
||||||
|
|
||||||
self.write_file(args.replace)
|
self.write_file(in_place=args.replace, stdout=args.stdout)
|
||||||
|
|
||||||
def write_file(self, in_place=False, stdout=False):
|
def write_file(self, in_place=False, stdout=False):
|
||||||
self.renumber()
|
self.renumber()
|
||||||
|
@ -456,16 +456,18 @@ def parse_args(args):
|
||||||
# Flags that require section
|
# Flags that require section
|
||||||
if args.cut_out:
|
if args.cut_out:
|
||||||
if not args.begin and not args.end:
|
if not args.begin and not args.end:
|
||||||
panic('You must specify a section to work with', 64)
|
parser.print_usage(file=sys.stderr)
|
||||||
|
panic('fsub: error: You must specify a section to work with', 64)
|
||||||
|
|
||||||
|
# Validate options
|
||||||
|
if not args.clean and args.config:
|
||||||
|
parser.print_usage(file=sys.stderr)
|
||||||
|
panic('fsub: error: --config requires --clean', 64)
|
||||||
|
|
||||||
# Make sure --clean is the default
|
# Make sure --clean is the default
|
||||||
if not any((args.shift, args.no_html, args.join, args.cut_out)):
|
if not any((args.shift, args.no_html, args.join, args.cut_out)):
|
||||||
args.clean = True
|
args.clean = True
|
||||||
|
|
||||||
# Validate options
|
|
||||||
if not args.clean and args.config:
|
|
||||||
panic('-f requires -c', 64)
|
|
||||||
|
|
||||||
if args.begin:
|
if args.begin:
|
||||||
args.begin = SectionMarker(args.begin)
|
args.begin = SectionMarker(args.begin)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue