move cli setup into each command file
Change-Id: Iae9d39c7fc55649a64a76a8351a3a349cbe5c028 Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
parent
0c530c7698
commit
6281ec4617
|
@ -59,31 +59,8 @@ def main():
|
|||
config.register_argparse_arguments(parser, sys.argv, None)
|
||||
subparsers = parser.add_subparsers(title='commands')
|
||||
|
||||
do_export = subparsers.add_parser(
|
||||
'export',
|
||||
help='export data',
|
||||
)
|
||||
do_export.add_argument(
|
||||
'resource_file',
|
||||
help='the name of the file listing resources to be exported',
|
||||
)
|
||||
do_export.add_argument(
|
||||
'output_path',
|
||||
default='.',
|
||||
nargs='?',
|
||||
help='the name of a directory to use for output file(s)',
|
||||
)
|
||||
do_export.set_defaults(func=export.export_data)
|
||||
|
||||
do_query = subparsers.add_parser(
|
||||
'query',
|
||||
help='query to build an export list',
|
||||
)
|
||||
do_query.add_argument(
|
||||
'resource_file',
|
||||
help='the name of the file listing resources to be updated',
|
||||
)
|
||||
do_query.set_defaults(func=query.query_data)
|
||||
export.register_command(subparsers)
|
||||
query.register_command(subparsers)
|
||||
|
||||
args = parser.parse_args(sys.argv[1:])
|
||||
|
||||
|
|
|
@ -24,6 +24,24 @@ from downpour import resources
|
|||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def register_command(subparsers):
|
||||
do_export = subparsers.add_parser(
|
||||
'export',
|
||||
help='export data',
|
||||
)
|
||||
do_export.add_argument(
|
||||
'resource_file',
|
||||
help='the name of the file listing resources to be exported',
|
||||
)
|
||||
do_export.add_argument(
|
||||
'output_path',
|
||||
default='.',
|
||||
nargs='?',
|
||||
help='the name of a directory to use for output file(s)',
|
||||
)
|
||||
do_export.set_defaults(func=export_data)
|
||||
|
||||
|
||||
def export_data(cloud, config, args):
|
||||
output_path = args.output_path
|
||||
|
||||
|
|
|
@ -12,6 +12,24 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import logging
|
||||
|
||||
import yaml
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def register_command(subparsers):
|
||||
do_query = subparsers.add_parser(
|
||||
'query',
|
||||
help='query to build an export list',
|
||||
)
|
||||
do_query.add_argument(
|
||||
'resource_file',
|
||||
help='the name of the file listing resources to be updated',
|
||||
)
|
||||
do_query.set_defaults(func=query_data)
|
||||
|
||||
|
||||
def query_data(cloud, config, args):
|
||||
raise NotImplementedError('query not implemented')
|
||||
|
|
Loading…
Reference in New Issue