File tree Expand file tree Collapse file tree 3 files changed +38
-3
lines changed Expand file tree Collapse file tree 3 files changed +38
-3
lines changed Original file line number Diff line number Diff line change @@ -67,7 +67,14 @@ cppsm test-watch
67
67
Clone an existing project:
68
68
69
69
``` bash
70
- git clone URI
70
+ cppsm clone URL BRANCH
71
+ ```
72
+
73
+ Or clone an existing project using plain git:
74
+
75
+ ``` bash
76
+ git clone -b BRANCH URL/NAME.git
77
+ cd NAME
71
78
git submodule update --init # NOTE: non-recursive
72
79
```
73
80
Original file line number Diff line number Diff line change @@ -10,20 +10,27 @@ __cppsm_complete() {
10
10
case " $PREVIOUS " in
11
11
cppsm)
12
12
# shellcheck disable=SC2207
13
- COMPREPLY=($( compgen -W " add build build-watch hello init list remove setup test test-watch update-all" -- " $CURRENT " ) )
13
+ COMPREPLY=($( compgen -W " add build build-watch clone hello init list remove setup test test-watch update-all" -- " $CURRENT " ) )
14
14
;;
15
15
add)
16
16
# shellcheck disable=SC2207
17
17
COMPREPLY=($( compgen -W " equipment requires" -- " $CURRENT " ) )
18
18
;;
19
+ clone)
20
+ if command -v jq > /dev/null && command -v curl > /dev/null && command -v sed > /dev/null; then
21
+ # shellcheck disable=SC2207
22
+ COMPREPLY=($( curl -s " https://api.github.com/search/repositories?q=topic:cppsm+${CURRENT##*/ } " | \
23
+ jq ' .items | .[] | .ssh_url' ) )
24
+ fi
25
+ ;;
19
26
equipment|requires)
20
27
if command -v jq > /dev/null && command -v curl > /dev/null && command -v sed > /dev/null; then
21
28
# shellcheck disable=SC2207
22
29
COMPREPLY=($( curl -s " https://api.github.com/search/repositories?q=topic:cppsm+${CURRENT##*/ } " | \
23
30
jq ' .items | .[] | .clone_url' ) )
24
31
fi
25
32
;;
26
- https:* .git)
33
+ https:* .git|git * .git )
27
34
if command -v sed > /dev/null; then
28
35
# shellcheck disable=SC2207
29
36
COMPREPLY=($( git ls-remote --heads " $PREVIOUS " | sed -e ' s#[^ ]*\s*refs/heads/##g' ) )
Original file line number Diff line number Diff line change
1
+ #! /bin/bash -e
2
+
3
+ # shellcheck source=.settings
4
+ . " ${BASH_SOURCE%/* } /.settings"
5
+
6
+ if [ " $# " -ne 2 ]; then
7
+ CMD=" ${0##*/ } "
8
+ cat << EOF
9
+ Usage: $CMD url branch
10
+
11
+ Clones the specified cppsm compatible repository and its dependencies.
12
+ EOF
13
+ exit 1
14
+ fi
15
+
16
+ NAME=" ${1% .git} "
17
+ NAME=" ${NAME##*/ } "
18
+
19
+ git clone -b " $2 " " $1 "
20
+ cd " $NAME "
21
+ git submodule update --init
You can’t perform that action at this time.
0 commit comments