summaryrefslogtreecommitdiff
path: root/plugins/perms
diff options
context:
space:
mode:
authorMarc Cornellà <marc.cornella@live.com>2019-05-08 20:40:36 +0200
committerGitHub <noreply@github.com>2019-05-08 20:40:36 +0200
commit0232ac4bb1cb64b5bfaa7e5fc979d6f7ab23e534 (patch)
tree946d9f8b758ebdd63da96152ca56b154c99068da /plugins/perms
parentafb028763cf40fc339e49011b2cba124dc108fcb (diff)
parentebc700be9b2fa7ae770a644093a5c46a8e323726 (diff)
downloadzsh-0232ac4bb1cb64b5bfaa7e5fc979d6f7ab23e534.tar.gz
zsh-0232ac4bb1cb64b5bfaa7e5fc979d6f7ab23e534.tar.bz2
zsh-0232ac4bb1cb64b5bfaa7e5fc979d6f7ab23e534.zip
Merge branch 'master' into master
Diffstat (limited to 'plugins/perms')
-rw-r--r--plugins/perms/README.md6
-rw-r--r--plugins/perms/perms.plugin.zsh8
2 files changed, 9 insertions, 5 deletions
diff --git a/plugins/perms/README.md b/plugins/perms/README.md
index 873c21d42..324b3f3cc 100644
--- a/plugins/perms/README.md
+++ b/plugins/perms/README.md
@@ -4,6 +4,6 @@ Plugin to handle some unix filesystem permissions quickly
### Usage
-* `set755` recursively sets all directories located within the current working directory and sub directories to octal 755.
-* `set644` recursively sets all files located within the current working directory and sub directories to octal 644.
-* `fixperms` is a wrapper around `set755` and `set644` applied to a specified directory or the current directory otherwise. It also prompts prior to execution unlike the other two aliases. \ No newline at end of file
+* `set755` recursively sets all given directories (default to .) to octal 755.
+* `set644` recursively sets all given files (default to .) to octal 644.
+* `fixperms` is a wrapper around `set755` and `set644` applied to a specified directory or the current directory otherwise. It also prompts prior to execution unlike the other two aliases.
diff --git a/plugins/perms/perms.plugin.zsh b/plugins/perms/perms.plugin.zsh
index 7cdebab7f..1a7472c1c 100644
--- a/plugins/perms/perms.plugin.zsh
+++ b/plugins/perms/perms.plugin.zsh
@@ -6,10 +6,14 @@
### Aliases
# Set all files' permissions to 644 recursively in a directory
-alias set644='find . -type f ! -perm 644 -print0 | xargs -0 chmod 644'
+set644() {
+ find "${@:-.}" -type f ! -perm 644 -print0 | xargs -0 chmod 644
+}
# Set all directories' permissions to 755 recursively in a directory
-alias set755='find . -type d ! -perm 755 -print0 | xargs -0 chmod 755'
+set755() {
+ find "${@:-.}" -type d ! -perm 755 -print0 | xargs -0 chmod 755
+}
### Functions