mirror of
https://github.com/wahyd4/gvm.git
synced 2026-08-09 04:46:19 +10:00
Merge pull request #31 from modcloth-labs/linkthis
Adding `gvm linkthis` command
This commit is contained in:
Executable
+35
@@ -0,0 +1,35 @@
|
||||
#!/usr/bin/env bash
|
||||
. $GVM_ROOT/scripts/functions
|
||||
|
||||
function show_usage() {
|
||||
echo "Usage: gvm linkthis <package-name> [options]"
|
||||
echo " -h, --help Display this message."
|
||||
}
|
||||
|
||||
package_name="$(basename "$PWD")"
|
||||
|
||||
function read_command_line() {
|
||||
for i in $*; do
|
||||
case $i in
|
||||
-h|--help*)
|
||||
show_usage
|
||||
exit 0
|
||||
;;
|
||||
-*|--*)
|
||||
echo "Invalid option $i"
|
||||
show_usage
|
||||
exit 65 # Bad arguments
|
||||
;;
|
||||
*)
|
||||
package_name="$i"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
read_command_line "$@"
|
||||
|
||||
target="${GOPATH%%:*}/src/$package_name"
|
||||
|
||||
mkdir -p "$(dirname "$target")"
|
||||
ln -sv "$PWD" "$target"
|
||||
Reference in New Issue
Block a user