#!/usr/bin/python3 import subprocess import os import sys print('') print('') os.chdir('../..') for l in subprocess.run(['run/%s' % sys.argv[1], '--help'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT).stdout.splitlines(): l = l.strip().decode('UTF-8') if not l.startswith('-'): continue s = l.split() print('', end='') e = 0 n = 0 if l.startswith('-') and not l.startswith('--'): print('%s, ' % s[0][:-1], end='') n = 1 e = len(s[0]) + 2 if l.find('<') != -1: print('%s %s' % (s[n], s[n+1].replace('<', '<').replace('>', '>')), end='') e += len(s[n]) + len(s[n+1]) + 1 else: print('%s' % s[n], end='') e += len(s[n]) desc = l[e:].strip() fixed_desc = '' t = False for i in desc: if i == '"' and t == False: fixed_desc += '“' t = True elif i == '"' and t == True: fixed_desc += '”' t = False else: fixed_desc += i print(' — %s' % fixed_desc) print('') print('', end='') os.chdir('doc/manual')