--readonly-uri for 'tahoe list-aliases'
This commit is contained in:
parent
ce47f6aaee
commit
a9521b89a6
|
@ -82,6 +82,9 @@ class CreateAliasOptions(FilesystemOptions):
|
||||||
class ListAliasesOptions(FilesystemOptions):
|
class ListAliasesOptions(FilesystemOptions):
|
||||||
synopsis = "[options]"
|
synopsis = "[options]"
|
||||||
description = """Display a table of all configured aliases."""
|
description = """Display a table of all configured aliases."""
|
||||||
|
optFlags = [
|
||||||
|
("readonly-uri", None, "Show read-only dircaps instead of readwrite"),
|
||||||
|
]
|
||||||
|
|
||||||
class ListOptions(FilesystemOptions):
|
class ListOptions(FilesystemOptions):
|
||||||
optFlags = [
|
optFlags = [
|
||||||
|
|
|
@ -105,8 +105,11 @@ def list_aliases(options):
|
||||||
fmt = "%" + str(max_width) + "s: %s"
|
fmt = "%" + str(max_width) + "s: %s"
|
||||||
rc = 0
|
rc = 0
|
||||||
for name in alias_names:
|
for name in alias_names:
|
||||||
|
dircap = uri.from_string(aliases[name])
|
||||||
|
if options['readonly-uri']:
|
||||||
|
dircap = dircap.get_readonly()
|
||||||
try:
|
try:
|
||||||
print >>stdout, fmt % (unicode_to_output(name), unicode_to_output(aliases[name].decode('utf-8')))
|
print >>stdout, fmt % (unicode_to_output(name), unicode_to_output(dircap.to_string().decode('utf-8')))
|
||||||
except (UnicodeEncodeError, UnicodeDecodeError):
|
except (UnicodeEncodeError, UnicodeDecodeError):
|
||||||
print >>stderr, fmt % (quote_output(name), quote_output(aliases[name]))
|
print >>stderr, fmt % (quote_output(name), quote_output(aliases[name]))
|
||||||
rc = 1
|
rc = 1
|
||||||
|
|
Loading…
Reference in New Issue