mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2025-07-05 20:41:47 -07:00
[build] Extend use of devscripts/utils
This commit is contained in:
parent
d38c9addfb
commit
22856054d6
15 changed files with 99 additions and 74 deletions
|
@ -5,8 +5,12 @@ import os
|
|||
from os.path import dirname as dirn
|
||||
import sys
|
||||
|
||||
sys.path.insert(0, dirn(dirn((os.path.abspath(__file__)))))
|
||||
sys.path.insert(0, dirn(dirn(os.path.abspath(__file__))))
|
||||
|
||||
import youtube_dl
|
||||
from youtube_dl.compat import compat_open as open
|
||||
|
||||
from utils import read_file
|
||||
|
||||
BASH_COMPLETION_FILE = "youtube-dl.bash-completion"
|
||||
BASH_COMPLETION_TEMPLATE = "devscripts/bash-completion.in"
|
||||
|
@ -18,9 +22,8 @@ def build_completion(opt_parser):
|
|||
for option in group.option_list:
|
||||
# for every long flag
|
||||
opts_flag.append(option.get_opt_string())
|
||||
with open(BASH_COMPLETION_TEMPLATE) as f:
|
||||
template = f.read()
|
||||
with open(BASH_COMPLETION_FILE, "w") as f:
|
||||
template = read_file(BASH_COMPLETION_TEMPLATE)
|
||||
with open(BASH_COMPLETION_FILE, "w", encoding='utf-8') as f:
|
||||
# just using the special char
|
||||
filled_template = template.replace("{{flags}}", " ".join(opts_flag))
|
||||
f.write(filled_template)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue