docs: Check if GOPATH exists before sourcing command-completion
Dylan Powers committed
Apr 21, 2015 at 13:35 UTC
d6d038bf3a83289bd3c6802905e2288b05f99665
1 file changed
+6
-2
docs/command-completion.md
+6
-2
@@ -13,8 +13,12 @@ Linux
13
-----
14
### Bash
15
16
-For bash, completion can be enabled in a couple of ways. One is to add the line
17
-`source $GOPATH/src/github.com/ipfs/go-ipfs/misc/completion/ipfs-completion.bash`
16
+For bash, completion can be enabled in a couple of ways. One is to add
17
+```bash
18
+if [ -n "$GOPATH" ]; then
19
+ source $GOPATH/src/github.com/ipfs/go-ipfs/misc/completion/ipfs-completion.bash
20
+fi
21
+```
22
into your `~/.bash_completion`. It will automatically be loaded the next time
23
bash is loaded.
24
To enable ipfs command completion globally on your system you may also