mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Intersphinx: add a small helper to print out inventories when called from the command line with -m.
This commit is contained in:
parent
6bd30d9b04
commit
77e5ff2639
@ -24,6 +24,8 @@
|
||||
:license: BSD, see LICENSE for details.
|
||||
"""
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import time
|
||||
import zlib
|
||||
import codecs
|
||||
@ -286,3 +288,23 @@ def setup(app):
|
||||
app.connect('missing-reference', missing_reference)
|
||||
app.connect('builder-inited', load_mappings)
|
||||
return {'version': sphinx.__display_version__, 'parallel_read_safe': True}
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
# debug functionality to print out an inventory
|
||||
import sys
|
||||
|
||||
class MockApp(object):
|
||||
srcdir = ''
|
||||
|
||||
def warn(self, msg):
|
||||
print(msg, file=sys.stderr)
|
||||
|
||||
filename = sys.argv[1]
|
||||
invdata = fetch_inventory(MockApp(), '', filename)
|
||||
for key in sorted(invdata or {}):
|
||||
print(key)
|
||||
for entry, einfo in sorted(invdata[key].items()):
|
||||
print('\t%-40s %s%s' % (entry,
|
||||
einfo[3] != '-' and '%-40s: ' % einfo[3] or '',
|
||||
einfo[2]))
|
||||
|
Loading…
Reference in New Issue
Block a user