-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtimeclock.sh
executable file
·78 lines (64 loc) · 1.91 KB
/
timeclock.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
#!/bin/bash
source "./select_option.sh"
running=1
while [[ "$running" -eq 1 ]]; do
clear
echo "Welcome back."
echo
echo "Select one option using up/down keys and enter to confirm:"
echo
options=("Select Project" "Clock Out" "View Reports", "Exit")
select_option "${options[@]}"
choice=$?
clear
# Clocking In
if [[ $choice == 0 ]]; then
options=()
clock_files=`ls ./Clocks/*.clock`
for next_clock in $clock_files; do
options+=("${next_clock#"./Clocks/"}")
done
options+=("Create New Project" "Exit")
clear
echo "Select a project to clock into."
echo
select_option "${options[@]}"
choice=$?
clear
# special case for if a new project is being created
if [[ $choice == `expr ${#options[@]} - 2` ]]; then
echo -n "Enter the name for your new project (or enter nothing to exit): "
read new_name
if [[ ${#new_name} -gt 0 ]]; then
touch ./Clocks/$new_name.clock
else
continue
fi
selected_clock=${new_name}
elif [[ $choice == `expr ${#options[@]} - 1` ]]; then
continue
else
selected_clock=${options[$choice]}
fi
clear
echo -n "Currently selected project: "
echo $new_name
echo -n "Current project pay: "
echo "tmp"
echo
options=("Clock In" "Change Project Name" "Change Project Pay" "Delete Project" "Return to Main Menu")
select_option "${options[@]}"
choice=$?
clear
# Clocking Out
elif [[ $choice == 1 ]]; then
echo " value = ${options[$choice]}"
# Run Reports
elif [[ $choice == 2 ]]; then
echo " value = ${options[$choice]}"
# Exit
else
clear
running=0
fi
done