mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-04 16:34:47 +01:00
Update xontrib description
Installation instructions are now hidden if the xontrib is preinstalled with xonsh. Also adds a 'Usage' section on how to enable the xontrib.
This commit is contained in:
parent
a036149be8
commit
2ee57ce2b8
1 changed files with 14 additions and 4 deletions
18
docs/conf.py
18
docs/conf.py
|
@ -319,7 +319,8 @@ def make_xontribs():
|
|||
':Website: {url}\n'
|
||||
':Package: {pkg}\n\n'
|
||||
'{desc}\n\n'
|
||||
'{inst}'
|
||||
'{inst}\n\n'
|
||||
'{usage}'
|
||||
'-------\n\n')
|
||||
for name in names:
|
||||
for d in md['xontribs']:
|
||||
|
@ -334,6 +335,7 @@ def make_xontribs():
|
|||
if pkgname is None:
|
||||
pkg = 'unknown'
|
||||
inst = ''
|
||||
usage = ''
|
||||
else:
|
||||
pd = md['packages'].get(pkgname, {})
|
||||
pkg = pkgname
|
||||
|
@ -343,16 +345,24 @@ def make_xontribs():
|
|||
pkg = pkg + ', ' + pd['license']
|
||||
inst = ''
|
||||
installd = pd.get('install', {})
|
||||
if len(installd) > 0:
|
||||
if pkgname == 'xonsh':
|
||||
inst = ('This xontrib is preinstalled with xonsh.\n\n')
|
||||
elif len(installd) > 0:
|
||||
inst = ('**Installation:**\n\n'
|
||||
'.. code-block:: xonsh\n\n')
|
||||
for k, v in sorted(pd.get('install', {}).items()):
|
||||
cmd = "\n ".join(v.split('\n'))
|
||||
inst += (' # install with {k}\n'
|
||||
' {cmd}\n\n').format(k=k, cmd=cmd)
|
||||
' {cmd}').format(k=k, cmd=cmd)
|
||||
usage = ('**Usage:**\n\n'
|
||||
'Run the following command to enable (or add '
|
||||
'it to your :doc:`.xonshrc </xonshrc>` file to enable '
|
||||
'on startup.)\n\n'
|
||||
'.. code-block:: xonsh\n\n')
|
||||
usage += ' xontrib load {}\n\n'.format(name)
|
||||
s += sec.format(low=name.lower(), title=title, under=under,
|
||||
url=d.get('url', 'unknown'), desc=desc,
|
||||
pkg=pkg, inst=inst)
|
||||
pkg=pkg, inst=inst, usage=usage)
|
||||
s = s[:-9]
|
||||
fname = os.path.join(os.path.dirname(__file__), 'xontribsbody')
|
||||
with open(fname, 'w') as f:
|
||||
|
|
Loading…
Add table
Reference in a new issue