mirror of
https://github.com/dcarrillo/prezto.git
synced 2025-07-01 20:59:26 +00:00
Compare commits
2 Commits
pull/552-g
...
pull/539-p
Author | SHA1 | Date | |
---|---|---|---|
a97e8de21b | |||
725e7720de |
@ -5,11 +5,8 @@
|
|||||||
# Completes git-hub-shorten-url.
|
# Completes git-hub-shorten-url.
|
||||||
#
|
#
|
||||||
# Authors:
|
# Authors:
|
||||||
# Joel Kuzmarski <leoj3n@gmail.com>
|
|
||||||
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
||||||
#
|
#
|
||||||
|
|
||||||
_arguments \
|
_arguments '1:url:' && return 0
|
||||||
'1:url:' \
|
|
||||||
'2:slug:' && return 0
|
|
||||||
|
|
||||||
|
@ -2,29 +2,21 @@
|
|||||||
# Shortens GitHub URLs.
|
# Shortens GitHub URLs.
|
||||||
#
|
#
|
||||||
# Authors:
|
# Authors:
|
||||||
# Joel Kuzmarski <leoj3n@gmail.com>
|
|
||||||
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
||||||
#
|
#
|
||||||
|
|
||||||
local url="$1"
|
local url="$1"
|
||||||
|
|
||||||
if [[ -z "$url" ]]; then
|
if [[ "$url" == '-' ]]; then
|
||||||
print "usage: $0 [ url | - ] [slug]" >&2
|
|
||||||
return 1
|
|
||||||
elif [[ "$url" == '-' ]]; then
|
|
||||||
read url <&0
|
read url <&0
|
||||||
elif [[ "$url" != *github.com* ]]; then
|
fi
|
||||||
url="https://github.com/$url"
|
|
||||||
|
if [[ -z "$url" ]]; then
|
||||||
|
print "usage: $0 [ url | - ]" >&2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if (( $+commands[curl] )); then
|
if (( $+commands[curl] )); then
|
||||||
local result="$(curl -s -i 'http://git.io' -F "url=$url" -F "code=$2")"
|
curl -s -i 'http://git.io' -F "url=$url" | grep 'Location:' | sed 's/Location: //'
|
||||||
|
|
||||||
if [[ $result == *Unprocessable* ]]; then
|
|
||||||
print "$0: the slug '$2' is already taken!" >&2
|
|
||||||
else
|
|
||||||
print $result | grep 'Location:' | sed 's/Location: //'
|
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
print "$0: command not found: curl" >&2
|
print "$0: command not found: curl" >&2
|
||||||
fi
|
fi
|
||||||
|
@ -12,7 +12,10 @@ pacman --query --explicit --info \
|
|||||||
FS=" : "
|
FS=" : "
|
||||||
}
|
}
|
||||||
/^Name/ {
|
/^Name/ {
|
||||||
print $2
|
printf "\033[0;01m" $2 "\033[0m"
|
||||||
|
}
|
||||||
|
/^Version/ {
|
||||||
|
print " \033[1;32m" $2 "\033[0m"
|
||||||
}
|
}
|
||||||
/^Description/ {
|
/^Description/ {
|
||||||
print $2
|
print $2
|
||||||
|
@ -64,7 +64,7 @@ alias pacs="${_pacman_frontend} --sync --search"
|
|||||||
alias pacS="${_pacman_frontend} --query --search"
|
alias pacS="${_pacman_frontend} --query --search"
|
||||||
|
|
||||||
# Lists orphan packages.
|
# Lists orphan packages.
|
||||||
alias pacman-list-orphans="${_pacman_sudo}${_pacman_frontend} --query --deps --unrequired"
|
alias pacman-list-orphans="${_pacman_frontend} --query --deps --unrequired"
|
||||||
|
|
||||||
# Removes orphan packages.
|
# Removes orphan packages.
|
||||||
alias pacman-remove-orphans="${_pacman_sudo}${_pacman_frontend} --remove --recursive \$(${_pacman_frontend} --quiet --query --deps --unrequired)"
|
alias pacman-remove-orphans="${_pacman_sudo}${_pacman_frontend} --remove --recursive \$(${_pacman_frontend} --quiet --query --deps --unrequired)"
|
||||||
|
Reference in New Issue
Block a user