mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-04-08 19:34:18 +00:00
CLI ls: add --readonly-uri to display readonly URIs for all children
This commit is contained in:
parent
e889463f0c
commit
a8ed3208ba
@ -85,7 +85,8 @@ class AddAliasOptions(VDriveOptions):
|
||||
class ListOptions(VDriveOptions):
|
||||
optFlags = [
|
||||
("long", "l", "Use long format: show file sizes, and timestamps"),
|
||||
("uri", "u", "Show file URIs"),
|
||||
("uri", "u", "Show file/directory URIs"),
|
||||
("readonly-uri", None, "Show readonly file/directory URIs"),
|
||||
("classify", "F", "Append '/' to directory names, and '*' to mutable"),
|
||||
("json", None, "Show the raw JSON output"),
|
||||
]
|
||||
|
@ -56,6 +56,8 @@ def list(nodeurl, aliases, where, config, stdout, stderr):
|
||||
t0 = "-"
|
||||
size = child[1]['size']
|
||||
classify = ""
|
||||
if rw_uri:
|
||||
classify = "*"
|
||||
else:
|
||||
t0 = "?"
|
||||
size = "?"
|
||||
@ -77,6 +79,8 @@ def list(nodeurl, aliases, where, config, stdout, stderr):
|
||||
line.append("%s %10s %12s" % (t0+t1+t2+t3, size, ctime_s))
|
||||
if config["uri"]:
|
||||
line.append(uri)
|
||||
if config["readonly-uri"]:
|
||||
line.append(ro_uri or "-")
|
||||
line.append(name)
|
||||
if config["classify"]:
|
||||
line[-1] += classify
|
||||
|
@ -1605,6 +1605,9 @@ class SystemTest(testutil.SignalMixin, testutil.PollMixin, testutil.StallMixin,
|
||||
# tahoe put bar tahoe:FOO
|
||||
d.addCallback(run, "put", files[2], "tahoe:file2")
|
||||
d.addCallback(run, "put", "--mutable", files[3], "tahoe:file3")
|
||||
def _check_put_mutable((out,err)):
|
||||
self._mutable_file3_uri = out.strip()
|
||||
d.addCallback(_check_put_mutable)
|
||||
|
||||
def _put_from_stdin(res, data, *args):
|
||||
args = nodeargs + list(args)
|
||||
@ -1677,6 +1680,26 @@ class SystemTest(testutil.SignalMixin, testutil.PollMixin, testutil.StallMixin,
|
||||
self.failUnless(l.startswith("-rw- "), l) # mutable
|
||||
d.addCallback(_check_ls_l)
|
||||
|
||||
d.addCallback(run, "ls", "--uri")
|
||||
def _check_ls_uri((out,err)):
|
||||
lines = out.split("\n")
|
||||
for l in lines:
|
||||
if "file3" in l:
|
||||
self.failUnless(self._mutable_file3_uri in l)
|
||||
d.addCallback(_check_ls_uri)
|
||||
|
||||
d.addCallback(run, "ls", "--readonly-uri")
|
||||
def _check_ls_rouri((out,err)):
|
||||
lines = out.split("\n")
|
||||
for l in lines:
|
||||
if "file3" in l:
|
||||
rw_uri = self._mutable_file3_uri
|
||||
u = uri.from_string_mutable_filenode(rw_uri)
|
||||
ro_uri = u.get_readonly().to_string()
|
||||
self.failUnless(ro_uri in l)
|
||||
d.addCallback(_check_ls_rouri)
|
||||
|
||||
|
||||
d.addCallback(run, "mv", "tahoe-file-stdin", "tahoe-moved")
|
||||
d.addCallback(run, "ls")
|
||||
d.addCallback(_check_ls, ["tahoe-moved"], ["tahoe-file-stdin"])
|
||||
|
Loading…
x
Reference in New Issue
Block a user