Skip to content

Convert to Python 3 #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions cli2man
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def transform(pattern):
while groups:
children = groups.pop(0)
parents = [Required, Optional, OptionsShortcut, Either, OneOrMore]
if any(t in map(type, children) for t in parents):
if any(t in list(map(type, children)) for t in parents):
child = [c for c in children if type(c) in parents][0]
children.remove(child)
if type(child) is Either:
Expand Down Expand Up @@ -534,7 +534,7 @@ def formal_usage(section):

def extras(help, version, options, doc):
if help and any((o.name in ('-h', '--help')) and o.value for o in options):
print(doc.strip("\n"))
print((doc.strip("\n")))
sys.exit()
if version and any(o.name == '--version' and o.value for o in options):
print(version)
Expand Down Expand Up @@ -749,7 +749,7 @@ class MDocFormatter(ManualFormatter):
for child in pattern.children:
c=str().rjust((4*l+4),'-')
t = type(child)
print(c+str(type(child)))
print((c+str(type(child))))
if hasattr(child,"children"):
self.print_synopsis_tree(child,pattern,l+1)

Expand Down Expand Up @@ -962,7 +962,7 @@ class Manual():
self.push_to_section()

for section in std_sections:
if section.lower() in [s.lower() for s in self.sections.keys()]:
if section.lower() in [s.lower() for s in list(self.sections.keys())]:
self.string += self.sections[section.upper()]
if section.upper() in self.subsections: #does the section have at least one subsection?
for subsection in self.subsections[section.upper()]:
Expand Down Expand Up @@ -1296,10 +1296,10 @@ if opt['--print-order']:
for section in manual.section_order:
if section == "MDOC INIT":
continue
print(" "+section)
print((" "+section))
print("____________________")
print()
print(" --set-order \""+(','.join(manual.section_order[1:])+"\""))
print((" --set-order \""+(','.join(manual.section_order[1:])+"\"")))
print("____________________")
print()
print("NOTE: You can use this string as basis for modifying the section order.")
Expand Down Expand Up @@ -1337,12 +1337,12 @@ if include:
manual.include_parse(include)

if opt['--info-section']:
for info_section in opt['--info-section'] if not isinstance(opt['--info-section'],basestring) else [opt['--info-section']]:
for info_section in opt['--info-section'] if not isinstance(opt['--info-section'],str) else [opt['--info-section']]:
manual.append_section_if_not_exists(info_section)
manual.parse_info_section(out,info_section)

if opt['--option-section']:
for option_section in opt['--option-section'] if not isinstance(opt['--option-section'],basestring) else [opt['--option-section']]:
for option_section in opt['--option-section'] if not isinstance(opt['--option-section'],str) else [opt['--option-section']]:
manual.append_section_if_not_exists(option_section)
manual.parse_option_section(out,option_section)

Expand Down Expand Up @@ -1373,7 +1373,7 @@ if opt['--output']:
f.write(manual.string)
f.close()
else:
print(manual.string)
print((manual.string))

if opt['--create-script']:
args = sys.argv[1:]
Expand Down