mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-04-14 06:06:40 +00:00
CLI: make 'tahoe create-alias' and 'tahoe add-alias' accept a trailing colon on the new alias name (v2, minor change not to rely on implicit Unicode conversion). Includes doc changes and news; tests in a separate patch. fixes #1305
This commit is contained in:
parent
b9fb74d2a0
commit
f10a2c0902
2
NEWS
2
NEWS
@ -7,6 +7,8 @@
|
||||
- 'top' on some Unix platforms, e.g. Linux, now shows node processes as
|
||||
'tahoe' instead of 'python'. (#174)
|
||||
- Improve HTML formatting of the WUI. (#1219)
|
||||
- The 'tahoe create-alias' and 'tahoe add-alias' commands now accept a
|
||||
trailing colon on the alias. (#1305)
|
||||
|
||||
** Removals
|
||||
|
||||
|
@ -247,9 +247,9 @@ access to your files and directories.
|
||||
Command Syntax Summary
|
||||
----------------------
|
||||
|
||||
``tahoe add-alias ALIAS DIRCAP``
|
||||
``tahoe add-alias ALIAS[:] DIRCAP``
|
||||
|
||||
``tahoe create-alias ALIAS``
|
||||
``tahoe create-alias ALIAS[:]``
|
||||
|
||||
``tahoe list-aliases``
|
||||
|
||||
@ -290,7 +290,7 @@ In these summaries, ``PATH``, ``TOPATH`` or ``FROMPATH`` can be one of:
|
||||
Command Examples
|
||||
----------------
|
||||
|
||||
``tahoe add-alias ALIAS DIRCAP``
|
||||
``tahoe add-alias ALIAS[:] DIRCAP``
|
||||
|
||||
An example would be::
|
||||
|
||||
@ -301,6 +301,9 @@ Command Examples
|
||||
directory. Use "``tahoe add-alias tahoe DIRCAP``" to set the contents of the
|
||||
default ``tahoe:`` alias.
|
||||
|
||||
Since Tahoe-LAFS v1.8.2, the alias name can be given with or without the
|
||||
trailing colon.
|
||||
|
||||
``tahoe create-alias fun``
|
||||
|
||||
This combines "``tahoe mkdir``" and "``tahoe add-alias``" into a single step.
|
||||
|
@ -57,19 +57,23 @@ class MakeDirectoryOptions(VDriveOptions):
|
||||
class AddAliasOptions(VDriveOptions):
|
||||
def parseArgs(self, alias, cap):
|
||||
self.alias = argv_to_unicode(alias)
|
||||
if self.alias.endswith(u':'):
|
||||
self.alias = self.alias[:-1]
|
||||
self.cap = cap
|
||||
|
||||
def getSynopsis(self):
|
||||
return "%s add-alias ALIAS DIRCAP" % (os.path.basename(sys.argv[0]),)
|
||||
return "%s add-alias ALIAS[:] DIRCAP" % (os.path.basename(sys.argv[0]),)
|
||||
|
||||
longdesc = """Add a new alias for an existing directory."""
|
||||
|
||||
class CreateAliasOptions(VDriveOptions):
|
||||
def parseArgs(self, alias):
|
||||
self.alias = argv_to_unicode(alias)
|
||||
if self.alias.endswith(u':'):
|
||||
self.alias = self.alias[:-1]
|
||||
|
||||
def getSynopsis(self):
|
||||
return "%s create-alias ALIAS" % (os.path.basename(sys.argv[0]),)
|
||||
return "%s create-alias ALIAS[:]" % (os.path.basename(sys.argv[0]),)
|
||||
|
||||
longdesc = """Create a new directory and add an alias for it."""
|
||||
|
||||
|
@ -32,8 +32,13 @@ def add_alias(options):
|
||||
cap = options.cap
|
||||
stdout = options.stdout
|
||||
stderr = options.stderr
|
||||
assert ":" not in alias
|
||||
assert " " not in alias
|
||||
if u":" in alias:
|
||||
# a single trailing colon will already have been stripped if present
|
||||
print >>stderr, "Alias names cannot contain colons."
|
||||
return 1
|
||||
if u" " in alias:
|
||||
print >>stderr, "Alias names cannot contain spaces."
|
||||
return 1
|
||||
|
||||
old_aliases = get_aliases(nodedir)
|
||||
if alias in old_aliases:
|
||||
@ -53,8 +58,13 @@ def create_alias(options):
|
||||
alias = options.alias
|
||||
stdout = options.stdout
|
||||
stderr = options.stderr
|
||||
assert ":" not in alias
|
||||
assert " " not in alias
|
||||
if u":" in alias:
|
||||
# a single trailing colon will already have been stripped if present
|
||||
print >>stderr, "Alias names cannot contain colons."
|
||||
return 1
|
||||
if u" " in alias:
|
||||
print >>stderr, "Alias names cannot contain spaces."
|
||||
return 1
|
||||
|
||||
old_aliases = get_aliases(nodedir)
|
||||
if alias in old_aliases:
|
||||
|
Loading…
x
Reference in New Issue
Block a user