]> Raphaƫl G. Git Repositories - youtubedl/blob - devscripts/prepare_manpage.py
Prepare for release.
[youtubedl] / devscripts / prepare_manpage.py
1 from __future__ import unicode_literals
2
3 import io
4 import os.path
5 import sys
6 import re
7
8 ROOT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
9 README_FILE = os.path.join(ROOT_DIR, 'README.md')
10
11 with io.open(README_FILE, encoding='utf-8') as f:
12 readme = f.read()
13
14 PREFIX = '''%YOUTUBE-DL(1)
15
16 # NAME
17
18 youtube\-dl \- download videos from youtube.com or other video platforms
19
20 # SYNOPSIS
21
22 **youtube-dl** \[OPTIONS\] URL [URL...]
23
24 '''
25 readme = re.sub(r'(?s)^.*?(?=# DESCRIPTION)', '', readme)
26 readme = re.sub(r'\s+youtube-dl \[OPTIONS\] URL \[URL\.\.\.\]', '', readme)
27 readme = PREFIX + readme
28
29 if sys.version_info < (3, 0):
30 print(readme.encode('utf-8'))
31 else:
32 print(readme)