Extract parser into get_parser function

Extracted from https://github.com/naiquevin/pipdeptree/pull/27
This commit is contained in:
Marc Abramowitz 2016-12-10 08:56:26 -08:00
parent 88dfc34440
commit 8072e24d81
1 changed files with 6 additions and 1 deletions

View File

@ -377,7 +377,7 @@ def cyclic_deps(tree):
return cyclic return cyclic
def main(): def get_parser():
parser = argparse.ArgumentParser(description=( parser = argparse.ArgumentParser(description=(
'Dependency tree of the installed python packages' 'Dependency tree of the installed python packages'
)) ))
@ -418,6 +418,11 @@ def main():
'"raw" output that may be used by external tools. ' '"raw" output that may be used by external tools. '
'This option overrides all other options.' 'This option overrides all other options.'
)) ))
return parser
def main():
parser = get_parser()
args = parser.parse_args() args = parser.parse_args()
pkgs = pip.get_installed_distributions(local_only=args.local_only) pkgs = pip.get_installed_distributions(local_only=args.local_only)