Skip to content

Commit

Permalink
Fix dangerous warning about sys.argv as default value
Browse files Browse the repository at this point in the history
  • Loading branch information
pawamoy committed Dec 2, 2016
1 parent 1a8e0e4 commit effe263
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/shellman/cli.py
Expand Up @@ -30,7 +30,7 @@
from .formatter import get_formatter


def main(argv=sys.argv):
def main(argv=None):
"""
Main function.
Expand All @@ -45,9 +45,11 @@ def main(argv=sys.argv):
(default to text), get the according formatter class, instantiate it
with acquired doc and write on stdout.
"""

if argv is None:
argv = sys.argv[1:]

f = argv[0]
if f == sys.argv[0]:
f = argv[1]
doc = Doc(f).read()
fmt = os.environ.get('SHELLMAN_FORMAT', 'text')
get_formatter(fmt)(doc).write()
Expand Down

0 comments on commit effe263

Please sign in to comment.