App-git-hub
view release on metacpan or search on metacpan
share/lib/git-hub.d/git-hub-url view on Meta::CPAN
#!/usr/bin/env bash
# Try this vim command:
#
# :map \ghu :let $l=line(".")<cr>:let $p=@%<cr>:!echo -n "$(git hub url $p $l)" \| xsel -b<cr><cr>
set -e
command:url() {
set -- "${command_arguments[@]}"
local path= line=
if inside-git-repo && [ $# -gt 0 ] && [ -e "$1" ]; then
path="$1"
path="${path%/}"
[ -n "$2" ] && line="$2"
command_arguments=()
fi
get-args '?owner:get-user/repo:get-repo'
branch="$(git rev-parse --abbrev-ref HEAD)"
url="https://github.com/$owner/$repo/tree/$branch"
if [ -n "$path" ]; then
url+="/$path"
if [ -n "$line" ]; then
url+="#L$line"
fi
fi
if pipeline; then
echo -n "$url"
else
echo "$url"
fi
msg_ok=0
}
# vim: set lisp:
( run in 1.423 second using v1.01-cache-2.11-cpan-75ffa21a3d4 )