4 BASH_COMPLETION_FILE = "youtube-dl.bash_completion"
5 BASH_COMPLETION_TEMPLATE = "devscripts/bash_completion.template"
7 def build_completion(opt_parser):
9 for group in opt_parser.option_groups:
10 for option in group.option_list:
12 opts_flag.append(option.get_opt_string())
13 with open(BASH_COMPLETION_TEMPLATE) as f:
15 with open(BASH_COMPLETION_FILE, "w") as f:
16 #just using the special char
18 filled_template = template.replace("{{flags}}", " ".join(opts_flag))
19 f.write(filled_template)
21 parser = youtube_dl.parseOpts()[0]
22 build_completion(parser)