mirror of
https://github.com/oh-my-fish/oh-my-fish
synced 2024-11-03 15:40:32 +00:00
osx plugin: Updated description implementation, improved argument checking
This commit is contained in:
parent
d4acc8148a
commit
39f54c2805
@ -1,12 +1,5 @@
|
|||||||
# cd to the current Finder directory
|
# cd to the current Finder directory
|
||||||
|
|
||||||
function cdf
|
function cdf -d "cd to the current Finder directory"
|
||||||
if count $argv >/dev/null
|
|
||||||
switch $argv[1]
|
|
||||||
case -d --description
|
|
||||||
echo "cd to the current Finder directory"
|
|
||||||
return 0
|
|
||||||
end
|
|
||||||
end
|
|
||||||
cd (pfd)
|
cd (pfd)
|
||||||
end
|
end
|
@ -1,12 +1,9 @@
|
|||||||
# Play, pause etc. iTunes
|
# Play, pause etc. iTunes
|
||||||
|
|
||||||
function itunes
|
function itunes -d "Play, pause etc. iTunes. Use -h or --help for a more detailed description."
|
||||||
if count $argv >/dev/null
|
if [ (count $argv) -gt 0 ]
|
||||||
set -l opt $argv[1]
|
set -l opt $argv[1]
|
||||||
switch $opt
|
switch $opt
|
||||||
case -d --description
|
|
||||||
echo "Play, pause etc. iTunes. Use -h or --help for a more detailed description."
|
|
||||||
return 0
|
|
||||||
case launch play pause stop rewind resume quit
|
case launch play pause stop rewind resume quit
|
||||||
case mute
|
case mute
|
||||||
set opt "set mute to true"
|
set opt "set mute to true"
|
||||||
|
@ -1,12 +1,5 @@
|
|||||||
# Open a specified man page in Preview
|
# Open a specified man page in Preview
|
||||||
|
|
||||||
function manp
|
function manp -d "Open a specified man page in Preview"
|
||||||
if count $argv >/dev/null
|
|
||||||
switch $argv[1]
|
|
||||||
case -d --description
|
|
||||||
echo "Open a specified man page in Preview"
|
|
||||||
return 0
|
|
||||||
end
|
|
||||||
end
|
|
||||||
man -t $argv | open -f -a Preview
|
man -t $argv | open -f -a Preview
|
||||||
end
|
end
|
@ -1,13 +1,6 @@
|
|||||||
# Return the path of the frontmost Finder window
|
# Return the path of the frontmost Finder window
|
||||||
|
|
||||||
function pfd
|
function pfd -d "Return the path of the frontmost Finder window"
|
||||||
if count $argv >/dev/null
|
|
||||||
switch $argv[1]
|
|
||||||
case -d --description
|
|
||||||
echo "Return the path of the frontmost Finder window"
|
|
||||||
return 0
|
|
||||||
end
|
|
||||||
end
|
|
||||||
osascript 2>/dev/null -e '
|
osascript 2>/dev/null -e '
|
||||||
tell application "Finder"
|
tell application "Finder"
|
||||||
return POSIX path of (target of window 1 as alias)
|
return POSIX path of (target of window 1 as alias)
|
||||||
|
@ -1,13 +1,6 @@
|
|||||||
# Return the path of the frontmost Finder window
|
# Return the path of the frontmost Finder window
|
||||||
|
|
||||||
function pfs
|
function pfs -d "Return the path of the frontmost Finder window"
|
||||||
if count $argv >/dev/null
|
|
||||||
switch $argv[1]
|
|
||||||
case -d --description
|
|
||||||
echo "Return the path of the frontmost Finder window"
|
|
||||||
return 0
|
|
||||||
end
|
|
||||||
end
|
|
||||||
osascript 2>/dev/null -e '
|
osascript 2>/dev/null -e '
|
||||||
set output to ""
|
set output to ""
|
||||||
tell application "Finder" to set the_selection to selection
|
tell application "Finder" to set the_selection to selection
|
||||||
|
@ -1,12 +1,5 @@
|
|||||||
# pushd to the current Finder directory
|
# pushd to the current Finder directory
|
||||||
|
|
||||||
function pushdf
|
function pushdf -d "pushd to the current Finder directory"
|
||||||
if count $argv >/dev/null
|
|
||||||
switch $argv[1]
|
|
||||||
case -d --description
|
|
||||||
echo "pushd to the current Finder directory"
|
|
||||||
return 0
|
|
||||||
end
|
|
||||||
end
|
|
||||||
pushd (pfd)
|
pushd (pfd)
|
||||||
end
|
end
|
@ -1,14 +1,9 @@
|
|||||||
# Quick Look a specified file
|
# Quick Look a specified file
|
||||||
|
|
||||||
function ql
|
function ql -d "Quick Look a specified file"
|
||||||
if count $argv >/dev/null
|
if [ (count $argv) -gt 0 ]
|
||||||
switch $argv[1]
|
|
||||||
case -d --description
|
|
||||||
echo "Quick Look a specified file"
|
|
||||||
return 0
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if count $argv > 0
|
|
||||||
qlmanage >/dev/null ^/dev/null -p Applications/ &
|
qlmanage >/dev/null ^/dev/null -p Applications/ &
|
||||||
|
else
|
||||||
|
echo "No file or folder as argument given"
|
||||||
end
|
end
|
||||||
end
|
end
|
@ -1,12 +1,5 @@
|
|||||||
# Open the current directory in a new tab
|
# Open the current directory in a new tab
|
||||||
function tab
|
function tab -d "Open the current directory in a new tab"
|
||||||
if count $argv >/dev/null
|
|
||||||
switch $argv[1]
|
|
||||||
case -d --description
|
|
||||||
echo "Open the current directory in a new tab"
|
|
||||||
return 0
|
|
||||||
end
|
|
||||||
end
|
|
||||||
osascript 2>/dev/null -e '
|
osascript 2>/dev/null -e '
|
||||||
tell application "System Events"
|
tell application "System Events"
|
||||||
tell process "Terminal" to keystroke "t" using command down
|
tell process "Terminal" to keystroke "t" using command down
|
||||||
|
@ -1,23 +1,20 @@
|
|||||||
# Move a specified file to the Trash
|
# Move a specified file to the Trash
|
||||||
|
|
||||||
function trash
|
function trash -d "Move a specified file to the Trash"
|
||||||
if count $argv >/dev/null
|
if [ (count $argv) -gt 0 ]
|
||||||
switch $argv[1]
|
set -l trash_dir "$HOME/.Trash"
|
||||||
case -d --description
|
for item in $argv
|
||||||
echo "Move a specified file to the Trash"
|
if test -e $item
|
||||||
return 0
|
set -l item_name (basename $item)
|
||||||
end
|
if test -e "$trash_dir/$item_name"
|
||||||
end
|
set -l current_time (date "+%H.%M.%S")
|
||||||
set -l trash_dir "$HOME/.Trash"
|
mv -f "$item" "$trash_dir/$item_name $current_time"
|
||||||
for item in $argv
|
else
|
||||||
if test -e $item
|
mv -f "$item" "$trash_dir/"
|
||||||
set -l item_name (basename $item)
|
end
|
||||||
if test -e "$trash_dir/$item_name"
|
|
||||||
set -l current_time (date "+%H.%M.%S")
|
|
||||||
mv -f "$item" "$trash_dir/$item_name $current_time"
|
|
||||||
else
|
|
||||||
mv -f "$item" "$trash_dir/"
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
echo "No file(s) given to delete"
|
||||||
end
|
end
|
||||||
end
|
end
|
Loading…
Reference in New Issue
Block a user