Skip to content

Commit

Permalink
Updates commands module.
Browse files Browse the repository at this point in the history
Signed-off-by: Kouhei Maeda <mkouhei@palmtb.net>
  • Loading branch information
mkouhei committed Jan 28, 2016
1 parent 85a1000 commit 2dc853a
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions bootstrap_py/commands.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
# -*- coding: utf-8 -*-
"""bootstrap_py.commands."""
import os
import sys
import argparse
from bootstrap_py import __version__
from bootstrap_py import control, __version__

# ToDo:
# * Genarete Sphinx documentation
# * Choices the FLOSS Licence


def setoption(parser, keyword):
Expand Down Expand Up @@ -32,6 +37,13 @@ def setoption(parser, keyword):
help='Specify license.')


def set_default_options(parser):
"""default options."""
parser.add_argument('-o', '--outdir', action='store',
default=os.path.abspath(os.path.curdir),
help='Specify output directory.')


def parse_options():
"""setup options."""
parser = argparse.ArgumentParser(description='usage')
Expand All @@ -42,14 +54,17 @@ def parse_options():
setoption(parser, 'author_email')
setoption(parser, 'url')
setoption(parser, 'license')
set_default_options(parser)
return parser.parse_args()


def main():
"""main function."""
try:
args = parse_options()
args.func(args)
pkg_data = control.PackageData(args)
pkg_tree = control.PackageTree(pkg_data)
pkg_tree.generate()
except RuntimeError as exc:
sys.stderr.write(exc)
sys.exit(1)
Expand Down

0 comments on commit 2dc853a

Please sign in to comment.