mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-11 07:10:30 +00:00
[devscripts/make_contributing] Switch to optparse (Fixes #4483)
This commit is contained in:
parent
d86007873e
commit
ccbfaa83b0
@ -1,20 +1,20 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import argparse
|
|
||||||
import io
|
import io
|
||||||
|
import optparse
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
parser = argparse.ArgumentParser()
|
parser = optparse.OptionParser(usage='%prog INFILE OUTFILE')
|
||||||
parser.add_argument(
|
options, args = parser.parse_args()
|
||||||
'INFILE', help='README.md file name to read from')
|
if len(args) != 2:
|
||||||
parser.add_argument(
|
parser.error('Expected an input and an output filename')
|
||||||
'OUTFILE', help='CONTRIBUTING.md file name to write to')
|
|
||||||
args = parser.parse_args()
|
|
||||||
|
|
||||||
with io.open(args.INFILE, encoding='utf-8') as inf:
|
infile, outfile = args
|
||||||
|
|
||||||
|
with io.open(infile, encoding='utf-8') as inf:
|
||||||
readme = inf.read()
|
readme = inf.read()
|
||||||
|
|
||||||
bug_text = re.search(
|
bug_text = re.search(
|
||||||
@ -25,7 +25,7 @@ def main():
|
|||||||
|
|
||||||
out = bug_text + dev_text
|
out = bug_text + dev_text
|
||||||
|
|
||||||
with io.open(args.OUTFILE, 'w', encoding='utf-8') as outf:
|
with io.open(outfile, 'w', encoding='utf-8') as outf:
|
||||||
outf.write(out)
|
outf.write(out)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
Loading…
Reference in New Issue
Block a user