-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUserdata
executable file
·39 lines (33 loc) · 1.57 KB
/
Userdata
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
#!/bin/bash
# ANSI color codes
RESET="\033[0m"
BOLD="\033[1m"
BLUE="\033[34m"
CYAN="\033[36m"
GREEN="\033[32m"
YELLOW="\033[33m"
RED="\033[31m"
# Path to your SQLite database
DB_PATH="VikasJha.db"
# Fetch data from the database
total_tasks_created=$(sqlite3 "$DB_PATH" "SELECT COUNT(*) FROM test;")
total_tasks_done=$(sqlite3 "$DB_PATH" "SELECT COUNT(*) FROM test WHERE status = 'done';")
total_tasks_pending=$(sqlite3 "$DB_PATH" "SELECT COUNT(*) FROM test WHERE status = 'pending';")
tasks_working_on=$(sqlite3 "$DB_PATH" "SELECT Task FROM test WHERE status = 'in progress';" | tr '\n' ', ' | sed 's/, $//')
projects_working_on=$(sqlite3 "$DB_PATH" "SELECT DISTINCT Task FROM test WHERE Description LIKE '%#project%';" | tr '\n' ', ' | sed 's/, $//')
# Format the output
echo -e "${BOLD}${BLUE}User.name${RESET} : ${GREEN}ABC${RESET}"
echo -e "${BOLD}${BLUE}User.email${RESET} : ${GREEN}[email protected]${RESET}"
echo -e "${BOLD}${CYAN}Total tasks created${RESET} : ${YELLOW}$total_tasks_created${RESET}"
echo -e "${BOLD}${CYAN}Total tasks done${RESET} : ${YELLOW}$total_tasks_done${RESET}"
echo -e "${BOLD}${CYAN}Total tasks pending${RESET} : ${YELLOW}$total_tasks_pending${RESET}"
if [[ -n "$tasks_working_on" ]]; then
echo -e "${BOLD}${CYAN}Tasks working on${RESET} : ${GREEN}$tasks_working_on${RESET}"
else
echo -e "${BOLD}${CYAN}Tasks working on${RESET} : ${RED}None${RESET}"
fi
if [[ -n "$projects_working_on" ]]; then
echo -e "${BOLD}${CYAN}Projects working on${RESET} : ${GREEN}$projects_working_on${RESET}"
else
echo -e "${BOLD}${CYAN}Projects working on${RESET} : ${RED}None${RESET}"
fi