def cp(ctx, old_path, new_path, force):
"""Copies the password or directory names `old-path` to `new-path`.
This command is alternatively named `copy`. If `--force` is
specified, silently overwrite `new_path` if it exists. If
`new-path` ends in a trailing `/`, it is always treated as a
directory. Passwords are selectively reencrypted to the
corresponding keys of their new destination.
"""
try:
ctx.obj.copy_path(old_path, new_path, force)
except StoreNotInitialisedError:
click.echo(MSG_STORE_NOT_INITIALISED_ERROR)
return 1
except FileNotFoundError:
click.echo('{0} is not in the password store.'.format(old_path))
return 1
except PermissionError:
click.echo(MSG_PERMISSION_ERROR)
return 1
except RecursiveCopyMoveError:
click.echo(MSG_RECURSIVE_COPY_MOVE_ERROR.format('copy'))
return 1
评论列表
文章目录