Skip to content

Commit

Permalink
Moved __main__ code into main() function that can be referenced as an…
Browse files Browse the repository at this point in the history
… entry point script, and added a reference to it in setup.py
  • Loading branch information
stephenmcd committed Nov 20, 2011
1 parent 0586179 commit ff24bab
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 5 additions & 1 deletion html2text.py
Expand Up @@ -714,7 +714,7 @@ def html2text(html, baseurl=''):
h = HTML2Text(baseurl=baseurl)
return h.handle(html)

if __name__ == "__main__":
def main():
baseurl = ''

p = optparse.OptionParser('%prog [(filename|url) [encoding]]',
Expand Down Expand Up @@ -782,3 +782,7 @@ def html2text(html, baseurl=''):
h.hide_strikethrough = options.hide_strikethrough

wrapwrite(h.handle(data))


if __name__ == "__main__":
main()
4 changes: 4 additions & 0 deletions setup.py
Expand Up @@ -24,6 +24,10 @@
'Programming Language :: Python :: 3.1',
'Programming Language :: Python :: 3.2'
],
entry_points="""
[console_scripts]
html2text=html2text:main
""",
license='GNU GPL 3',
packages=find_packages(),
py_modules=['html2text'],
Expand Down

0 comments on commit ff24bab

Please sign in to comment.