Open AndydeCleyre opened 7 years ago
I somehow just noticed (or forgot) about the existing local.as_user
context manager. Does that work when nesting path commands?
Please do not forget to about RemotePath. In case of servers where only non-root SSH is possible, code becomes ugly fast.
I suppose this could be added to all methods, but in case list above would be used, please add also mkdir
.
Hi,
As discussed a bit over at #9, the way path-operations-as-root must be done presently is not as pythonic as possible, and introduces a wide syntax disparity between those operations and the "same" operations done as the normal user.
I propose that all path operations gain a keyword argument to either activate sudo for that operation, or (more flexibly) specify a user to run that operation as. So something akin to
sudo=False
,root=False
,as_root=False
,as_user=None
,user=None
, orsudo_user=None
."path operations" refers to these, at least:
delete
copy
move
symlink
link
unlink
chmod
chown
is_file
is_dir
exists
is_symlink
stat