diff options
| author | Carl Hetherington <cth@carlh.net> | 2019-01-28 22:25:07 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2019-01-28 22:25:07 +0000 |
| commit | 154be392632ffb5a95cce71a824ede728f32dd09 (patch) | |
| tree | ac98b79cdfb4dc0830ac2b247d875bb04fd9d587 /doc/manual/cli.py | |
| parent | 5028c1790d8bd1c4b50afbf3fd6fe71441b3c8ae (diff) | |
Manual updates.
Diffstat (limited to 'doc/manual/cli.py')
| -rw-r--r-- | doc/manual/cli.py | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/doc/manual/cli.py b/doc/manual/cli.py new file mode 100644 index 000000000..3a2493b4d --- /dev/null +++ b/doc/manual/cli.py @@ -0,0 +1,49 @@ +#!/usr/bin/python3 +import subprocess +import os +import sys + +print('<para>') +print('<itemizedlist>') + +os.chdir('../..') +for l in subprocess.run(['run/%s' % sys.argv[1], '--help'], stderr=subprocess.PIPE).stderr.splitlines(): + l = l.strip().decode('UTF-8') + if not l.startswith('-'): + continue + + s = l.split() + print('<listitem>', end='') + + e = 0 + n = 0 + if l.startswith('-') and not l.startswith('--'): + print('<code>%s</code>, ' % s[0][:-1], end='') + n = 1 + e = len(s[0]) + 2 + + if l.find('<') != -1: + print('<code>%s %s</code>' % (s[n], s[n+1].replace('<', '<').replace('>', '>')), end='') + e += len(s[n]) + len(s[n+1]) + 1 + else: + print('<code>%s</code>' % 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</listitem>' % fixed_desc) + +print('</itemizedlist>') +print('</para>', end='') +os.chdir('doc/manual') |
