-
Notifications
You must be signed in to change notification settings - Fork 0
/
flutter-custom-widget
executable file
·67 lines (57 loc) · 1.2 KB
/
flutter-custom-widget
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
#!/bin/bash
if [[ -z "$@" ]]; then
echo "Invalid usage of flutter-custom-widget"
echo "Try 'flutter-custom-widget -h' for more information"
exit 1
fi
checkFlutterDirectory() {
PUBSPEC_FILE=./pubspec.yaml
if [[ ! -f "$PUBSPEC_FILE" ]]; then
echo 'Not a flutter project directory'
exit 1
fi
}
installPackage() {
case "$1" in
error_pop_up)
#TODO(wdvictor) Find a way to find where is the FCW dir
echo 'installing error pop up'
#REPO=$(whereis flutter-custom-widget)
REPO="$HOME/Github/FlutterCustomWidget"
cp "$REPO/error_pop_up/error_popup.dart" ./lib
echo "'error_pop_up' installed in you lib folder"
;;
\?)
echo "Package '$1' not found"
echo "Try 'flutter-custom-widget -l ' to list packages available"
exit 1
;;
esac
}
while getopts :hi: opt; do
case $opt in
h)
echo "flutter-custom-widget"
echo "by Victor Hugo (github.com/wdvictor)"
;;
i)
checkFlutterDirectory
installPackage "$OPTARG"
;;
\?)
echo "Invalid option -$opt" >&2
exit 1
;;
*)
echo "Invalid usage of flutter-custom-widget"
echo "Try 'flutter-custom-widget -h' for more information"
exit 1
;;
esac
case $OPTARG in
-*)
echo "Option $opt needs a valid argument"
exit 1
;;
esac
done