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
6767Clone an existing project:
6868
6969``` 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
7178git submodule update --init # NOTE: non-recursive
7279```
7380
Original file line number Diff line number Diff line change @@ -10,20 +10,27 @@ __cppsm_complete() {
1010 case " $PREVIOUS " in
1111 cppsm)
1212 # 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 " ) )
1414 ;;
1515 add)
1616 # shellcheck disable=SC2207
1717 COMPREPLY=($( compgen -W " equipment requires" -- " $CURRENT " ) )
1818 ;;
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+ ;;
1926 equipment|requires)
2027 if command -v jq > /dev/null && command -v curl > /dev/null && command -v sed > /dev/null; then
2128 # shellcheck disable=SC2207
2229 COMPREPLY=($( curl -s " https://api.github.com/search/repositories?q=topic:cppsm+${CURRENT##*/ } " | \
2330 jq ' .items | .[] | .clone_url' ) )
2431 fi
2532 ;;
26- https:* .git)
33+ https:* .git|git * .git )
2734 if command -v sed > /dev/null; then
2835 # shellcheck disable=SC2207
2936 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