Skip to content

Commit 20fd46a

Browse files
committed
Change default repositories folder
The default folder now is $HOME/github. This can be changed by setting the GH_GET_FOLDER and GH_GET_ROOT environment variables.
1 parent 831302c commit 20fd46a

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

README.md

+8-1
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,19 @@ A GitHub CLI based copy of https://github.com/x-motemen/ghq
1010

1111
`gh get OWNER/REPO`
1212

13-
This will clone the repository identified by OWNER/REPO into `$HOME/workspace/$OWNER/$REPO`.
13+
This will clone the repository identified by OWNER/REPO into `$HOME/github/$OWNER/$REPO`.
1414

1515
Example:
1616

1717
`gh get britter/gh-get` will clone this respository into `~/workspace/britter/gh-get`
1818

19+
## Configuration
20+
21+
There are two environment variables that control the location gh-get clones repositories to:
22+
23+
- `GH_GET_FOLDER`: The name of the folder inside the user home that repositories are cloned into. The defaults to `github` which means repositories are cloned into `$HOME/github`. If you prefer a different folder name or path inside your user home, configure this variable.
24+
- `GH_GET_ROOT`: The full path to to the folder that repositories are cloned into. This defaults to `$HOME/$GH_GET_FOLDER`. Change this is you want repositories to be cloned to a location _outside_ your user home.
25+
1926
## License
2027

2128
Code is under the [Apache Licence v2](https://www.apache.org/licenses/LICENSE-2.0.txt).

gh-get

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
#!/usr/bin/env bash
22
set -e
33

4+
REPOSITORIES_FOLDER_NAME=${GH_GET_FOLDER:-github}
5+
6+
REPOSITORIES_ROOT=${GH_GET_ROOT:-$HOME/$REPOSITORIES_FOLDER_NAME}
7+
48
IFS='/' array=($1)
5-
exec gh repo clone "${array[0]}/${array[1]}" "$HOME/workspace/${array[0]}/${array[1]}"
9+
exec gh repo clone "${array[0]}/${array[1]}" "$REPOSITORIES_ROOT/${array[0]}/${array[1]}"

0 commit comments

Comments
 (0)