@jswork/ushell-module-git 1.0.8 → 1.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/modules/01-gcd.sh +13 -2
  2. package/package.json +1 -4
package/modules/01-gcd.sh CHANGED
@@ -1,9 +1,20 @@
1
1
  #!/usr/bin/env bash
2
2
  GIT_URL=$1;
3
3
  dir=`basename $GIT_URL .git`;
4
+ orgname=`echo $GIT_URL | awk -F [:/] '{print$2}'`;
4
5
 
5
- if [ -d $dir ]; then
6
- cd $dir && git pull;
6
+ # A special case for `afeiship` org.
7
+ if [ $orgname == 'afeiship' ]; then
8
+ orgname='github';
9
+ fi
10
+
11
+ localdir="$HOME/$orgname/$dir";
12
+
13
+ # test local dir, if exists, cd to it and pull, else mkdir and clone
14
+ if [ -d $localdir ]; then
15
+ cd $localdir && git pull;
7
16
  else
17
+ subdir=`dirname $localdir`;
18
+ mkdir -p $subdir && cd $subdir;
8
19
  git clone $GIT_URL && cd $dir;
9
20
  fi
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jswork/ushell-module-git",
3
- "version": "1.0.8",
3
+ "version": "1.0.9",
4
4
  "description": "Unix like shell module for git.",
5
5
  "main": "index.sh",
6
6
  "repository": {
@@ -28,8 +28,5 @@
28
28
  ],
29
29
  "scripts": {
30
30
  "release": "release-it"
31
- },
32
- "devDependencies": {
33
- "release-it": "^15.5.0"
34
31
  }
35
32
  }