diff --git a/README b/README index 818919d..863c778 100644 --- a/README +++ b/README @@ -10,6 +10,7 @@ Features * Manage GOPATHs with `gvm pkgset [create/use/delete] [name]`. Use `--local` as `name` to manage repository under local path (`/path/to/repo/.gvm_local`). * List latest release tags with `gvm listall`. Use `--all` to list weekly as well. * Cache a clean copy of the latest Go source for multiple version installs. +* Link project directories into GOPATH Background ========== diff --git a/README.md b/README.md index 818919d..863c778 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,7 @@ Features * Manage GOPATHs with `gvm pkgset [create/use/delete] [name]`. Use `--local` as `name` to manage repository under local path (`/path/to/repo/.gvm_local`). * List latest release tags with `gvm listall`. Use `--all` to list weekly as well. * Cache a clean copy of the latest Go source for multiple version installs. +* Link project directories into GOPATH Background ========== diff --git a/bin/gvm b/bin/gvm index e5d1a60..26c440e 100755 --- a/bin/gvm +++ b/bin/gvm @@ -46,6 +46,7 @@ Commands: install - install go versions uninstall - uninstall go versions cross - install go cross compilers + linkthis - link this directory into GOPATH list - list installed go versions listall - list available versions alias - manage go version aliases diff --git a/scripts/linkthis b/scripts/linkthis index c3acc4d..3dfaf4e 100755 --- a/scripts/linkthis +++ b/scripts/linkthis @@ -2,12 +2,18 @@ . $GVM_ROOT/scripts/functions function show_usage() { - echo "Usage: gvm linkthis [options]" - echo " -h, --help Display this message." + echo "Usage: gvm linkthis [package-name] [options]" + echo " -h, --help Display this message." + echo + echo "If the [package-name] is provided, it will be used in the path based" + echo "at \${GOPATH%%:*}/src, e.g.:" + echo + echo " gvm linkthis github.com/moovweb/gpkg" + echo + echo "If omitted, the [package-name] will be the basename of the current" + echo "directory, e.g. '$package_name_basename'." } -package_name="$(basename "$PWD")" - function read_command_line() { for i in $*; do case $i in @@ -20,13 +26,16 @@ function read_command_line() { show_usage exit 65 # Bad arguments ;; - *) - package_name="$i" - ;; + *) + package_name="$i" + ;; esac done } +package_name="$(basename "$PWD")" +package_name_basename="$package_name" + read_command_line "$@" target="${GOPATH%%:*}/src/$package_name"