Skip to content

Commit

Permalink
Allow overriding sys.argv for argparse (Fixes: #69)
Browse files Browse the repository at this point in the history
  • Loading branch information
irl committed Oct 19, 2016
1 parent 5fedd3b commit 5ff1181
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pathspider/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

plugins = load("pathspider.plugins", subclasses=PluggableSpider)

def handle_args():
def handle_args(argv):
class SubcommandHelpFormatter(argparse.RawDescriptionHelpFormatter):
def _format_action(self, action):
parts = super()._format_action(action)
Expand Down Expand Up @@ -52,7 +52,7 @@ def _format_action(self, action):
parser.print_help()
sys.exit(1)

args = parser.parse_args()
args = parser.parse_args(argv[1:])

logging.basicConfig()
if args.verbose:
Expand All @@ -70,4 +70,4 @@ def _format_action(self, action):
run_standalone(args)

if __name__ == "__main__":
handle_args()
handle_args(sys.argv)

0 comments on commit 5ff1181

Please sign in to comment.