Skip to content

Commit 04fda78

Browse files
committed
- Change push command to only push the default
1 parent 7908e18 commit 04fda78

File tree

8 files changed

+51
-20
lines changed

8 files changed

+51
-20
lines changed

rush

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,11 @@ rush_push_usage() {
294294
printf " Show this help\n"
295295
echo
296296
# :command.usage_flags
297+
# :flag.usage
298+
echo " --all, -a"
299+
printf " Push all repositories.\n"
300+
echo
301+
297302
# :flag.usage
298303
echo " --message, -m TEXT"
299304
printf " Commit message.\n Default: automatic commit\n"
@@ -303,7 +308,7 @@ rush_push_usage() {
303308

304309
# :argument.usage
305310
echo " REPO"
306-
printf " Repository name.\n"
311+
printf " Repository name.\n Default: default\n"
307312
echo
308313

309314
fi
@@ -1060,7 +1065,8 @@ rush_pull_command() {
10601065
rush_push_command() {
10611066
# :src/push_command.sh
10621067
set +e
1063-
repo=${args[repo]}
1068+
all=${args[--all]}
1069+
repo=${args[repo]:-default}
10641070
message=${args[--message]:-"automatic commit"}
10651071

10661072
push_repo() {
@@ -1082,14 +1088,14 @@ rush_push_command() {
10821088
fi
10831089
}
10841090

1085-
if [[ $repo ]]; then
1086-
repo_path=$(config_get "$repo")
1087-
[[ $repo_path ]] || abort "no such repo: $repo"
1088-
push_repo "$repo_path" "$repo"
1089-
else
1091+
if [[ $all ]]; then
10901092
for k in $(config_keys); do
10911093
push_repo "$(config_get "$k")" "$k"
10921094
done
1095+
else
1096+
repo_path=$(config_get "$repo")
1097+
[[ $repo_path ]] || abort "no such repo: $repo"
1098+
push_repo "$repo_path" "$repo"
10931099
fi
10941100
}
10951101

@@ -1912,6 +1918,12 @@ rush_push_parse_requirements() {
19121918
while [[ $# -gt 0 ]]; do
19131919
key="$1"
19141920
case "$key" in
1921+
# :flag.case
1922+
--all | -a )
1923+
args[--all]=1
1924+
shift
1925+
;;
1926+
19151927
# :flag.case
19161928
--message | -m )
19171929
if [[ $2 ]]; then

src/bashly.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,15 @@ commands:
111111

112112
args:
113113
- name: repo
114-
help: Repository name.
114+
help: |-
115+
Repository name.
116+
Default: default
115117
116118
flags:
119+
- long: --all
120+
short: -a
121+
help: Push all repositories.
122+
117123
- long: --message
118124
short: -m
119125
arg: TEXT

src/push_command.sh

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
set +e
2-
repo=${args[repo]}
2+
all=${args[--all]}
3+
repo=${args[repo]:-default}
34
message=${args[--message]:-"automatic commit"}
45

56
push_repo() {
@@ -21,13 +22,13 @@ push_repo() {
2122
fi
2223
}
2324

24-
if [[ $repo ]]; then
25-
repo_path=$(config_get "$repo")
26-
[[ $repo_path ]] || abort "no such repo: $repo"
27-
push_repo "$repo_path" "$repo"
28-
else
25+
if [[ $all ]]; then
2926
for k in $(config_keys); do
3027
push_repo "$(config_get "$k")" "$k"
3128
done
29+
else
30+
repo_path=$(config_get "$repo")
31+
[[ $repo_path ]] || abort "no such repo: $repo"
32+
push_repo "$repo_path" "$repo"
3233
fi
3334

test/approvals/rush_push

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1 @@
11
push | skipping default (not a git repo)
2-
push | skipping sample (not a git repo)
3-
push | dannyben
4-
On branch master
5-
Your branch is up to date with 'origin/master'.
6-
7-
nothing to commit, working tree clean

test/approvals/rush_push_all

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
push | skipping default (not a git repo)
2+
push | skipping sample (not a git repo)
3+
push | dannyben
4+
On branch master
5+
Your branch is up to date with 'origin/master'.
6+
7+
nothing to commit, working tree clean

test/approvals/rush_push_dannyben

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
push | dannyben
2+
On branch master
3+
Your branch is up to date with 'origin/master'.
4+
5+
nothing to commit, working tree clean

test/approvals/rush_push_h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,14 @@ Options:
88
--help, -h
99
Show this help
1010

11+
--all, -a
12+
Push all repositories.
13+
1114
--message, -m TEXT
1215
Commit message.
1316
Default: automatic commit
1417

1518
Arguments:
1619
REPO
1720
Repository name.
21+
Default: default

test/approve

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@ describe "pull"
9595

9696
describe "push"
9797
approve "rush push"
98+
approve "rush push dannyben"
99+
approve "rush push --all"
98100
approve "rush push -h"
99101

100102
describe "remove"

0 commit comments

Comments
 (0)