Example #1
0
def add_laser_parser():
    parser = argparse.ArgumentParser(prog='datastore-add-laser', 
            description="Add a BDKD Resource to a datastore", 
            parents=[
                util_common._repository_resource_parser(),
                util_add._files_parser(),
                util_add._metadata_parser(),
                util_add._add_options_parser(),
                util_add._bdkd_metadata_parser(),
                _laser_metadata_parser(),
            ])
    return parser
Example #2
0
def add_laser_parser():
    parser = argparse.ArgumentParser(
        prog='datastore-add-laser',
        description="Add a BDKD Resource to a datastore",
        parents=[
            util_common._repository_resource_parser(),
            util_add._files_parser(),
            util_add._metadata_parser(),
            util_add._add_options_parser(),
            util_add._bdkd_metadata_parser(),
            _laser_metadata_parser(),
        ])
    return parser
Example #3
0
def _create_subparsers(subparser):
    subparser.add_parser('create', help='Create a new Resource',
                         description='Create new Resource, optionally with files and metadata',
                         parents=[
                             util_common._repository_resource_parser(),
                             _metadata_parser(),
                             _bdkd_metadata_parser(),
                             _create_options_parser(),
                             _optional_files_parser(),
                         ])

    subparser.add_parser('add-files', help='Add file(s) to an existing Resource',
                         description='Add one or more files to an existing Resource',
                         parents=[
                             util_common._repository_resource_parser(),
                             _files_parser(),
                             _add_files_parser()
                         ])
    subparser.add_parser('delete-files', help='Delete file(s) from an existing Resource',
                         description='Delete one or more files from an existing Resource by providing file names',
                         parents=[
                             util_common._repository_resource_parser(),
                             _delete_files_parser()
                         ])
    subparser.add_parser('copy', help='Copy a resource',
                         description='Copy a resource within datastore',
                         parents=[
                             _repository_resource_from_to_parser(),
                         ])
    subparser.add_parser('move', help='Move a resource',
                         description='Move a resource within datastore',
                         parents=[
                             _repository_resource_from_to_parser(),
                         ])
    subparser.add_parser('getkey', help='Get information about the key of a resource',
                         description='Get information about the key of a resource',
                         parents=[
                             util_common._repository_resource_parser(),
                         ])
    subparser.add_parser('lastmod', help='Get the last modified date of a resource',
                         description='Get the last modified date of a resource',
                         parents=[
                             util_common._repository_resource_parser(),
                         ])
    subparser.add_parser('update-metadata', help='Update a resource\'s metadata',
                         description='Update a resource\'s meta-data, including BDKD options',
                         parents=[
                             util_common._repository_resource_parser(),
                             _metadata_parser(),
                             _bdkd_metadata_parser(enforce=False)
                         ])
    subparser.add_parser('delete', help='Delete a resource from a repository',
                         description='Delete a resource from a repository',
                         parents=[
                             util_common._repository_resource_parser(),
                             _delete_resource_parser()
                         ])
    subparser.add_parser('get', help='Get details of a Resource as JSON text',
                         description='Get details of a Resource as JSON text. The meta-data and list '
                         'of Files for a Resource will be printed to STDOUT as JSON text',
                         parents=[
                             util_common._repository_resource_parser(),
                         ])
    subparser.add_parser('files', help='List of locally-cached filenames',
                         description='List of locally-cached filenames for the given Resource',
                         parents=[
                             util_common._repository_resource_parser(),
                         ])
    list_parser = subparser.add_parser('list', help='Get a list of all Resources in a Repository',
                         description='Get a list of all Resources in a Repository (or optionally '
                         'those Resources underneath a leading path).',
                         parents=[
                             util_common._repository_parser()
                         ])
    list_parser.add_argument('--path', '-p', help='Email address of the maintainer')
    list_parser.add_argument('--verbose', '-v', action='store_true', default=False,
                             help='Verbose mode: all resource details (default names only)')

    repositories_parser = subparser.add_parser('repositories', help='Get a list of all configured Repositories',
                                               description='Get a list of all configured Repositories')
    repositories_parser.add_argument('--verbose', '-v', action='store_true', default=False,
                                     help='Verbose mode: all resource details (default names only)')

    subparser.add_parser('rebuild-file-list', help='Rebuild Resource\'s file list',
                         description='Rebuild metadata file list of Resource by scanning all files',
                         parents=[
                             util_common._repository_resource_parser()
                         ])
    subparser.add_parser('publish', help='Publish a resource to a repository',
                         description='Publish a resource to a repository',
                         parents=[
                             util_common._repository_resource_parser(),
                         ])
    subparser.add_parser('unpublish', help='Unpublish a resource from a repository',
                         description='Unpublish a resource from a repository',
                         parents=[
                             util_common._repository_resource_parser(),
                         ])
    subparser.add_parser('get-file-list', help='Get a list of files (including path) from a Resource',
                         description='Get a list of files (including path) from a Resource',
                         parents=[
                             util_common._repository_resource_parser(),
                             _get_file_list_parser(),
                         ])

    return subparser