Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
oh-my-zsh
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
github
oh-my-zsh
Commits
46f8765f
Unverified
Commit
46f8765f
authored
Oct 20, 2021
by
Rob Vadai
Committed by
GitHub
Oct 20, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(osx): add `freespace` command to clean purgeable disk space (#8762)
Co-authored-by:
Marc Cornellà
<
hello@mcornella.com
>
parent
8c1495a1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
21 deletions
+45
-21
README.md
plugins/osx/README.md
+22
-21
osx.plugin.zsh
plugins/osx/osx.plugin.zsh
+23
-0
No files found.
plugins/osx/README.md
View file @
46f8765f
...
...
@@ -12,27 +12,28 @@ Original author: [Sorin Ionescu](https://github.com/sorin-ionescu)
## Commands
| Command | Description |
| :-------------- | :---------------------------------------------------- |
|
`tab`
| Open the current directory in a new tab |
|
`split_tab`
| Split the current terminal tab horizontally |
|
`vsplit_tab`
| Split the current terminal tab vertically |
|
`ofd`
| Open the current directory in a Finder window |
|
`pfd`
| Return the path of the frontmost Finder window |
|
`pfs`
| Return the current Finder selection |
|
`cdf`
|
`cd`
to the current Finder directory |
|
`pushdf`
|
`pushd`
to the current Finder directory |
|
`pxd`
| Return the current Xcode project directory |
|
`cdx`
|
`cd`
to the current Xcode project directory |
|
`quick-look`
| Quick-Look a specified file |
|
`man-preview`
| Open a specified man page in Preview app |
|
`showfiles`
| Show hidden files in Finder |
|
`hidefiles`
| Hide the hidden files in Finder |
|
`itunes`
| _DEPRECATED_. Use
`music`
from macOS Catalina on |
|
`music`
| Control Apple Music. Use
`music -h`
for usage details |
|
`spotify`
| Control Spotify and search by artist, album, track… |
|
`rmdsstore`
| Remove .DS
\_
Store files recursively in a directory |
|
`btrestart`
| Restart the Bluetooth daemon |
| Command | Description |
| :------------ | :------------------------------------------------------- |
|
`tab`
| Open the current directory in a new tab |
|
`split_tab`
| Split the current terminal tab horizontally |
|
`vsplit_tab`
| Split the current terminal tab vertically |
|
`ofd`
| Open the current directory in a Finder window |
|
`pfd`
| Return the path of the frontmost Finder window |
|
`pfs`
| Return the current Finder selection |
|
`cdf`
|
`cd`
to the current Finder directory |
|
`pushdf`
|
`pushd`
to the current Finder directory |
|
`pxd`
| Return the current Xcode project directory |
|
`cdx`
|
`cd`
to the current Xcode project directory |
|
`quick-look`
| Quick-Look a specified file |
|
`man-preview`
| Open a specified man page in Preview app |
|
`showfiles`
| Show hidden files in Finder |
|
`hidefiles`
| Hide the hidden files in Finder |
|
`itunes`
| _DEPRECATED_. Use
`music`
from macOS Catalina on |
|
`music`
| Control Apple Music. Use
`music -h`
for usage details |
|
`spotify`
| Control Spotify and search by artist, album, track… |
|
`rmdsstore`
| Remove .DS
\_
Store files recursively in a directory |
|
`btrestart`
| Restart the Bluetooth daemon |
|
`freespace`
| Erases purgeable disk space with 0s on the selected disk |
## Acknowledgements
...
...
plugins/osx/osx.plugin.zsh
View file @
46f8765f
...
...
@@ -233,6 +233,29 @@ function rmdsstore() {
find
"
${
@
:-
.
}
"
-type
f
-name
.DS_Store
-delete
}
# Erases purgeable disk space with 0s on the selected disk
function
freespace
(){
if
[[
-z
"
$1
"
]]
;
then
echo
"Usage:
$0
<disk>"
echo
"Example:
$0
/dev/disk1s1"
echo
echo
"Possible disks:"
df
-h
|
awk
'NR == 1 || /^\/dev\/disk/'
return
1
fi
echo
"Cleaning purgeable files from disk:
$1
...."
diskutil secureErase freespace 0
$1
}
_freespace
()
{
local
-a
disks
disks
=(
"
${
(@f)
"
$(
df
|
awk
'/^\/dev\/disk/{ printf $1 ":"; for (i=9; i<=NF; i++) printf $i FS; print "" }'
)
"
}
"
)
_describe disks disks
}
compdef _freespace freespace
# Music / iTunes control function
source
"
${
0
:h:A
}
/music"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment