def main(): """ Main function for the Data Manager. Processes the input arguments. """ version = 1.0 arguments = docopt(__doc__, version=version) if arguments['data'] and arguments['add']: provider = arguments['PROVIDER'] file = arguments['FILENAME'] upload_file_by_name(provider, file) elif arguments['data'] and arguments['list']: output_format = arguments["--format"] or 'table' if output_format == "table": config = Config() print(config.table()) elif output_format == "yaml": config = Config() print(config) elif arguments['data'] and arguments['get']: provider = arguments['PROVIDER'] user_uuid = arguments['USER_UUID'] file = arguments['FILENAME'] get_file_by_name(provider, file, user_uuid) elif arguments['data'] and arguments['ls']: provider = arguments['PROVIDER'] files = get_files(provider) config = Config() config.print(files) elif arguments['data'] and arguments['copy']: file = arguments['FILENAME'] source = arguments['PROVIDER'] dest = arguments['DEST'] copy_file(file, source, dest) elif arguments['data'] and arguments['rsync']: source = arguments['SOURCE'] dest = arguments['DEST'] filename = arguments['FILENAME'] # rsync_file(filename, source, dest) elif arguments['data'] and arguments['del']: provider = arguments['PROVIDER'] filename = arguments['FILENAME'] delete_file(provider, filename) elif arguments['update'] and arguments['user'] and arguments['file']: username = arguments['USER'] filename = arguments['FILENAME']
def main(): """ Main function for the Data Manager. Processes the input arguments. """ version = 1.0 arguments = docopt(__doc__, version=version) if arguments['data'] and arguments['add']: provider = arguments['PROVIDER'] bucketname = arguments['BUCKETNAME'] file = arguments['FILENAME'] # upload_file_by_name(provider, bucketname, file) elif arguments['data'] and arguments['list']: output_format = arguments["--format"] or 'table' if output_format == "table": config = Config() print(config.table()) elif output_format == "yaml": config = Config() print(config) elif arguments['data'] and arguments['get']: provider = arguments['PROVIDER'] bucketname = arguments['BUCKETNAME'] user_uuid = arguments['USER_UUID'] file = arguments['FILENAME'] # get_file_by_name(provider, bucketname, file, user_uuid) elif arguments['data'] and arguments['ls']: provider = arguments['PROVIDER'] bucket = arguments['BUCKETNAME'] # files = get_files(provider, bucket) # x = PrettyTable(["SNo", "Filename"]) # i = 1 # for file in files: # x.add_row([i, file]) # i = i + 1 #print(x) elif arguments['data'] and arguments['copy']: file = arguments['FILENAME'] source = arguments['PROVIDER'] sourcebucket = arguments['PROVIDER_BUCKET'] dest = arguments['DEST'] destbucket = arguments['DEST_BUCKET'] # copy_file(file, source, sourcebucket, dest, destbucket) elif arguments['data'] and arguments['rsync']: source = arguments['SOURCE'] dest = arguments['DEST'] filename = arguments['FILENAME'] # rsync_file(filename, source, dest) elif arguments['data'] and arguments['del']: provider = arguments['PROVIDER'] bucketname = arguments['BUCKETNAME'] filename = arguments['FILENAME'] # delete_file(provider, bucketname, filename) elif arguments['update'] and arguments['user'] and arguments['file']: username = arguments['USER'] filename = arguments['FILENAME']