Skip to content

Commit 221cea9

Browse files
committed
Shorten case-statements
1 parent 294d4cb commit 221cea9

File tree

2 files changed

+13
-43
lines changed

2 files changed

+13
-43
lines changed

git-fpaste

+4-16
Original file line numberDiff line numberDiff line change
@@ -64,22 +64,10 @@ cmd="${1}"
6464
shift
6565

6666
case "${cmd}" in
67-
am)
68-
am "$@"
69-
;;
70-
71-
apply)
72-
apply "$@"
73-
;;
74-
75-
diff)
76-
diff "$@"
77-
;;
78-
79-
format-patch)
80-
format-patch "$@"
81-
;;
82-
67+
am) am "$@" ;;
68+
apply) apply "$@" ;;
69+
diff) diff "$@" ;;
70+
format-patch) format-patch "$@" ;;
8371
*)
8472
echo "Usage: git fpaste <command> [<args>]"
8573
echo

git-fpaste-completion.bash

+9-27
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,11 @@ _git_fpaste () {
2626
fi
2727

2828
case "$subcommand" in
29-
am)
30-
_git_fpaste_am
31-
;;
32-
apply)
33-
_git_fpaste_apply
34-
;;
35-
diff)
36-
_git_diff
37-
;;
38-
format-patch)
39-
_git_format_patch
40-
;;
41-
*)
42-
COMPREPLY=()
43-
;;
29+
am) _git_fpaste_am ;;
30+
apply) _git_fpaste_apply ;;
31+
diff) _git_diff ;;
32+
format-patch) _git_format_patch ;;
33+
*) COMPREPLY=() ;;
4434
esac
4535
}
4636

@@ -55,22 +45,14 @@ __no_file_fallback () {
5545

5646
_git_fpaste_am () {
5747
case "$cur" in
58-
--*)
59-
_git_am
60-
;;
61-
*)
62-
__no_file_fallback
63-
;;
48+
--*) _git_am ;;
49+
*) __no_file_fallback ;;
6450
esac
6551
}
6652

6753
_git_fpaste_apply () {
6854
case "$cur" in
69-
--*)
70-
_git_apply
71-
;;
72-
*)
73-
__no_file_fallback
74-
;;
55+
--*) _git_apply ;;
56+
*) __no_file_fallback ;;
7557
esac
7658
}

0 commit comments

Comments
 (0)