summaryrefslogtreecommitdiff
path: root/src/stats.sh
blob: 8c2c1be70710169c46dd220ba44f70c8e3867edd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/sh

show_xipkg_stats () {
    printf "${LIGHT_CYAN}${XI}${BLUE}Pkg ${LIGHT_CYAN}$VERSION ${BLUE}on ${LIGHT_BLUE}%s\n" $(cat /etc/hostname)
    echo
    printf "${LIGHT_BLACK}%-7s%*s/%s\n" " " 10 "installed" "total"

    local total=0
    local installed=0
    for package in $(list); do
        total=$((total+1))
        [ -d ${INSTALLED_DIR}/${package} ] &&
            installed=$((installed+1))
    done

    printf "${LIGHT_WHITE}%-7s${GREEN}%*s${LIGHT_WHITE}/%s\n" "packages" 10 $installed $total
}