Skip to content

Commit

Permalink
Use seperate line to print comment regardless of parameter width #976
Browse files Browse the repository at this point in the history
  • Loading branch information
gaow committed May 30, 2018
1 parent 158ec46 commit 6cf99be
Showing 1 changed file with 12 additions and 26 deletions.
38 changes: 12 additions & 26 deletions src/sos/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -576,19 +576,12 @@ def show(self):
print(' Workflow Options:')
for name, (value, comment) in local_parameters.items():
par_str = f' {format_par(name, value)}'
if len(par_str) > 24:
print(par_str)
if comment:
print('\n'.join(textwrap.wrap(comment,
width=textWidth,
initial_indent=' '*24,
subsequent_indent=' ' * 24)))
else:
print(par_str + '\n'.join(textwrap.wrap(comment,
width=textWidth,
initial_indent=' '*(24 - len(par_str)),
subsequent_indent=' ' * 24)))

print(par_str)
if comment:
print('\n'.join(textwrap.wrap(comment,
width=textWidth,
initial_indent=' '*24,
subsequent_indent=' ' * 24)))


class SoS_Workflow:
Expand Down Expand Up @@ -1450,19 +1443,12 @@ def print_help(self, script_name: str):
print('\nGlobal Workflow Options:')
for name, (value,comment) in global_parameters.items():
par_str = f' {format_par(name, value)}'
if len(par_str) > 24:
print(par_str)
if comment:
print('\n'.join(textwrap.wrap(comment,
width=textWidth,
initial_indent=' '*24,
subsequent_indent=' ' * 24)))
else:
print(par_str + '\n'.join(textwrap.wrap(comment,
width=textWidth,
initial_indent=' '*(24 - len(par_str)),
subsequent_indent=' ' * 24)))

print(par_str)
if comment:
print('\n'.join(textwrap.wrap(comment,
width=textWidth,
initial_indent=' '*24,
subsequent_indent=' ' * 24)))
print('\nSections')
for section in self.sections:
section.show()

0 comments on commit 6cf99be

Please sign in to comment.