@jswork/ushell-module-git 1.0.8 → 1.0.10

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 +19 -2
  2. package/package.json +1 -4
package/modules/01-gcd.sh CHANGED
@@ -1,9 +1,26 @@
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}'`;
5
+ hub=`echo $GIT_URL | awk -F [:/] '{print$1}'`;
4
6
 
5
- if [ -d $dir ]; then
6
- cd $dir && git pull;
7
+ # if is hub is saybot
8
+ if [ $hub == 'git@git.saybot.net' ]; then
9
+ orgname='saybot';
10
+ fi
11
+
12
+ # A special case for `afeiship` org.
13
+ if [ $orgname == 'afeiship' ]; then
14
+ orgname='github';
15
+ fi
16
+
17
+ localdir="$HOME/$orgname/$dir";
18
+
19
+ # test local dir, if exists, cd to it and pull, else mkdir and clone
20
+ if [ -d $localdir ]; then
21
+ cd $localdir && git pull;
7
22
  else
23
+ subdir=`dirname $localdir`;
24
+ mkdir -p $subdir && cd $subdir;
8
25
  git clone $GIT_URL && cd $dir;
9
26
  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.10",
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
  }