d4cae83152d17fd73514532d57fb75a878b651cc

Author
Matthieu PETIOT <matt@ardeidae.com>
Committer
Marc Cornellà <marc.cornella@live.com>
Date

Message

osx: add function to remove .DS_Store files (#7008)

rmdsstore removes .DS_Store files recursively in the current directory by default, or for the given directories.

Diff

 1diff --git a/plugins/osx/README.md b/plugins/osx/README.md
 2index d3a8f94df972da8134c7cf6756a41da0597a0228..7c75c65f5548764730779e280381e40e3cdca9cd 100644
 3--- a/plugins/osx/README.md
 4+++ b/plugins/osx/README.md
 5@@ -42,19 +42,20 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 6 
 7 ## Commands
 8 
 9-| Command         | Description                                      |
10-| :-------------- | :----------------------------------------------- |
11-| `tab`           | Open the current directory in a new tab          |
12-| `split_tab`     | Split the current terminal tab horizontally      |
13-| `vsplit_tab`    | Split the current terminal tab vertically        |
14-| `ofd`           | Open the current directory in a Finder window    |
15-| `pfd`           | Return the path of the frontmost Finder window   |
16-| `pfs`           | Return the current Finder selection              |
17-| `cdf`           | `cd` to the current Finder directory             |
18-| `pushdf`        | `pushd` to the current Finder directory          |
19-| `quick-look`    | Quick-Look a specified file                      |
20-| `man-preview`   | Open a specified man page in Preview app         |
21-| `showfiles`     | Show hidden files                                |
22-| `hidefiles`     | Hide the hidden files                            |
23-| `itunes`        | Control iTunes. User `itunes -h` for usage details |
24-| `spotify`       | Control Spotify and search by artist, album, track and etc.|
25+| Command         | Description                                         |
26+| :-------------- | :-------------------------------------------------- |
27+| `tab`           | Open the current directory in a new tab             |
28+| `split_tab`     | Split the current terminal tab horizontally         |
29+| `vsplit_tab`    | Split the current terminal tab vertically           |
30+| `ofd`           | Open the current directory in a Finder window       |
31+| `pfd`           | Return the path of the frontmost Finder window      |
32+| `pfs`           | Return the current Finder selection                 |
33+| `cdf`           | `cd` to the current Finder directory                |
34+| `pushdf`        | `pushd` to the current Finder directory             |
35+| `quick-look`    | Quick-Look a specified file                         |
36+| `man-preview`   | Open a specified man page in Preview app            |
37+| `showfiles`     | Show hidden files                                   |
38+| `hidefiles`     | Hide the hidden files                               |
39+| `itunes`        | Control iTunes. User `itunes -h` for usage details  |
40+| `spotify`       | Control Spotify and search by artist, album, track… |
41+| `rmdsstore`     | Remove .DS\_Store files recursively in a directory  |
42diff --git a/plugins/osx/osx.plugin.zsh b/plugins/osx/osx.plugin.zsh
43index d99cf0b1e0ed890becf8271086bdcbc299a3471c..6a4b6eec4597c9f81bc9c08dc28ad6997afe54e4 100644
44--- a/plugins/osx/osx.plugin.zsh
45+++ b/plugins/osx/osx.plugin.zsh
46@@ -209,7 +209,7 @@ if [[ ! -z "$playlist" ]]; then
47 					opt="play"
48 				else
49 					opt="stop"
50-				fi	
51+				fi
52                   else
53                     opt="set allPlaylists to (get name of every playlist)"
54                   fi
55@@ -282,3 +282,8 @@ source ${ZSH}/plugins/osx/spotify
56 # Show/hide hidden files in the Finder
57 alias showfiles="defaults write com.apple.finder AppleShowAllFiles -bool true && killall Finder"
58 alias hidefiles="defaults write com.apple.finder AppleShowAllFiles -bool false && killall Finder"
59+
60+# Remove .DS_Store files recursively in a directory, default .
61+rmdsstore() {
62+	find "${@:-.}" -type f -name .DS_Store -delete
63+}