-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathflu.sh
executable file
·106 lines (89 loc) · 2.48 KB
/
flu.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#/bin/bash
# flutter shortcut commands
# see https://github.com/SimonErich/bash-shortcuts-flutter/ for more details
function flu() {
case $1 in
# Generic flutter commands
"get")
echo "Fetching flutter packages"
flutter pub get
return 0
;;
"analyze")
echo "Anylzing flutter project code"
flutter analyze
return 0
;;
"test")
echo "Run flutter project tests"
flutter test
return 0
;;
"format")
case $2 in
"")
echo "Checking flutter project code formatting"
flutter format .
return 0
;;
"fix")
echo "Fixing flutter project code formatting"
flutter format --fix .
return 0
;;
esac
;;
"format")
case $2 in
"")
echo "Checking flutter project formatting"
flutter format --fix .
return 0
;;
"fix")
echo "Fixing flutter project formatting"
flutter format --fix .
return 0
;;
esac
;;
"runner")
case $2 in
"")
echo "Running flutter build runner once"
flutter pub run build_runner build --delete-conflicting-outputs
return 0
;;
"watch")
echo "Running flutter build runner on watch"
flutter pub run build_runner watch --delete-conflicting-outputs
return 0
;;
esac
;;
# Specific to our environment
"build-widgetbook")
echo "Building widgetbook bundle for web deployment"
flutter run -t lib/widgetbook.widgetbook.dart -d chrome --web-renderer html --
return 0
;;
esac
GREEN_FG='\033[32m'
BOLD='\033[1;97m'
TITLE='\033[1;42;97m'
NC='\033[0m' # No Color
usage="
${TITLE} $(basename "$0") [command] -- small bash helper to abbreviate verbose flutter commands. ${NC}
${BOLD}[command]:${NC}
${GREEN_FG}get ${NC}flutter pub get
${GREEN_FG}analyze ${NC}flutter analyze
${GREEN_FG}test ${NC}flutter test
${GREEN_FG}format ${NC}flutter format . (just analyzes, but does not fix)
${GREEN_FG}format fix ${NC}flutter format --fix . (analyzes and fixes problems)
${GREEN_FG}runner ${NC}flutter pub run build_runner --delete-conflicting-outputs
${GREEN_FG}runner watch ${NC}flutter pub run build_runner watch --delete-conflicting-outputs
${BOLD}specific to our environment:
${GREEN_FG}build-widgetbook ${NC}flutter run -t lib/widgetbook.widgetbook.dart -d chrome --web-renderer html --\n"
echo "$usage"
return 1
}