| 1 |
#!/usr/bin/env python |
| 2 |
|
| 3 |
#----------------------------------------------------------------------------- |
| 4 |
# Copyright (c) 2013, The BiPy Development Team. |
| 5 |
# |
| 6 |
# Distributed under the terms of the Modified BSD License. |
| 7 |
# |
| 8 |
# The full license is in the file COPYING.txt, distributed with this software. |
| 9 |
#----------------------------------------------------------------------------- |
| 10 |
|
| 11 |
__author__ = "Daniel McDonald" |
| 12 |
__copyright__ = "Copyright 2013, The pyqi project" |
| 13 |
__credits__ = ["Daniel McDonald", "Greg Caporaso", "Doug Wendel", |
| 14 |
"Jai Ram Rideout"] |
| 15 |
__license__ = "BSD" |
| 16 |
__version__ = "0.1.0-dev" |
| 17 |
__maintainer__ = "Daniel McDonald" |
| 18 |
__email__ = "[email protected]" |
| 19 |
|
| 20 |
from pyqi.core.interfaces.optparse import (OptparseOption, |
| 21 |
OptparseResult, |
| 22 |
OptparseUsageExample) |
| 23 |
from pyqi.core.interfaces.optparse.output_handler import write_string |
| 24 |
from pyqi.core.command import make_parameter_collection_lookup_f |
| 25 |
from pyqi.commands.make_command import CommandConstructor |
| 26 |
|
| 27 |
param_lookup = make_parameter_collection_lookup_f(CommandConstructor) |
| 28 |
|
| 29 |
usage_examples = [ |
| 30 |
OptparseUsageExample(ShortDesc="Basic Command", |
| 31 |
LongDesc="Create a basic Command with appropriate attribution", |
| 32 |
Ex='%prog -n example -a "some author" -c "Copyright 2013, The pyqi project" -e "[email protected]" -l BSD --command-version "0.1" --credits "someone else","and another person" -o example.py') |
| 33 |
] |
| 34 |
|
| 35 |
inputs = [ |
| 36 |
OptparseOption(Parameter=param_lookup('name'), |
| 37 |
ShortName='n'), |
| 38 |
OptparseOption(Parameter=param_lookup('email'), |
| 39 |
ShortName='e'), |
| 40 |
OptparseOption(Parameter=param_lookup('author'), |
| 41 |
ShortName='a'), |
| 42 |
OptparseOption(Parameter=param_lookup('license'), |
| 43 |
ShortName='l'), |
| 44 |
OptparseOption(Parameter=param_lookup('copyright'), |
| 45 |
ShortName='c'), |
| 46 |
OptparseOption(Parameter=param_lookup('test_code')), |
| 47 |
OptparseOption(Parameter=param_lookup('command_version')), |
| 48 |
OptparseOption(Parameter=param_lookup('credits')), |
| 49 |
OptparseOption(Parameter=None, |
| 50 |
InputType='new_filepath', |
| 51 |
ShortName='o', |
| 52 |
Name='output-fp', |
| 53 |
Required=True, |
| 54 |
Help='output filepath to store generated Python code') |
| 55 |
] |
| 56 |
|
| 57 |
outputs = [ |
| 58 |
OptparseResult(ResultKey='result', |
| 59 |
OutputHandler=write_string, |
| 60 |
OptionName='output-fp') |
| 61 |
] |