Commit abaa96e2 authored by Julien Muchembled's avatar Julien Muchembled

download,upload: fix --url help

parent 26e67ce8
Pipeline #20436 failed with stage
in 0 seconds
......@@ -479,6 +479,8 @@ class NetworkcacheException(Exception):
DirectoryNotFound = UploadError = NetworkcacheException # BBB
key_help = \
" The key will be concatenation of PREFIX_KEY, md5(URL) and SUFFIX_KEY."
def _newArgumentParser(url_help):
parser = argparse.ArgumentParser()
......@@ -486,15 +488,14 @@ def _newArgumentParser(url_help):
help='SlapOS configuration file.')
parser.add_argument('--prefix-key', default='')
parser.add_argument('--suffix-key', default='')
parser.add_argument('--url', help=url_help
+ " The key will be concatenation of PREFIX_KEY, md5(URL) and SUFFIX_KEY."
" If not given, the uploaded data is not indexed.")
parser.add_argument('--url', help=url_help)
return parser
def cmd_upload(*args):
parser = _newArgumentParser("Upload data pointed to by this argument,"
" unless --file is specified. If argument is not a local path, contents"
" is first downloaded in a temporary file.")
parser = _newArgumentParser(
"Upload data pointed to by this argument, unless --file is specified."
" Non-local contents is first downloaded to a temporary file."
"%s If not given, the uploaded data is not indexed." % key_help)
parser.add_argument('--file',
help="Upload the contents of this file, overriding --url")
parser.add_argument('meta', nargs='*', metavar='KEY=VALUE',
......@@ -520,7 +521,7 @@ def cmd_upload(*args):
f is None or f.close()
def cmd_download(*args):
parser = _newArgumentParser("URL of data to download.")
parser = _newArgumentParser("URL of data to download." + key_help)
args = parser.parse_args(args or sys.argv[1:])
nc = NetworkcacheClient(args.config)
urlmd5 = hashlib.md5(args.url.encode()).hexdigest()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment