Skip to content

Commit

Permalink
PR jantman#366 - ensure that some 'None' limits appear in the CLI exa…
Browse files Browse the repository at this point in the history
…mples
  • Loading branch information
jantman authored and nadlerjessie committed Feb 16, 2019
1 parent e14a3e9 commit e2fc570
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions docs/build_generated_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,18 +255,25 @@ def format_cmd_output(cmd, output, name):
lines[idx] = line[:100] + ' (...)'
if len(lines) > 12:
tmp_lines = lines[:5] + ['(...)'] + lines[-5:]
if ' -l' not in cmd:
lines = tmp_lines
else:
# find a line that uses a limit from the API
api_line = '(...)'
if ' -l' in cmd or ' --list-defaults' in cmd:
# find a line that uses a limit from the API,
# and a line with None (unlimited)
api_line = None
none_line = None
for line in lines:
if '(API)' in line:
api_line = line
break
if api_line not in tmp_lines:
tmp_lines = lines[:5] + ['(...)'] + [ api_line ]
tmp_lines = tmp_lines + ['(...)'] + lines[-5:]
for line in lines:
if line.strip().endswith('None'):
none_line = line
break
tmp_lines = lines[:5]
if api_line not in tmp_lines and api_line is not None:
tmp_lines = tmp_lines + ['(...)'] + [api_line]
if none_line not in tmp_lines and none_line is not None:
tmp_lines = tmp_lines + ['(...)'] + [none_line]
tmp_lines = tmp_lines + ['(...)'] + lines[-5:]
lines = tmp_lines
for line in lines:
if line.strip() == '':
Expand Down

0 comments on commit e2fc570

Please sign in to comment.