<commit_before>#!/usr/bin/env bash

HEART_CONNECTED=♥
HEART_DISCONNECTED=♡

case $(uname -s) in
    "Darwin")
        ioreg -c AppleSmartBattery -w0 | \
        grep -o '"[^"]*" = [^ ]*' | \
        sed -e 's/= //g' -e 's/"//g' | \
        sort | \
        while read key value; do
            case $key in
                "MaxCapacity")
                    export maxcap=$value;;
                "CurrentCapacity")
                    export curcap=$value;;
                "ExternalConnected")
                    export extconnect=$value;;
            esac
            if [[ -n $maxcap && -n $curcap && -n $extconnect ]]; then
                if [[ "$curcap" == "$maxcap" ]]; then
                    exit
                fi
                export charge=$(( 100 * $curcap / $maxcap ))
                if [[ "$extconnect" == "Yes" ]]; then
                    echo $HEART_CONNECTED "$charge%"
                else
                    if [[ $charge -lt 50 ]]; then
                        echo -n "#[fg=red]"
                    fi
                    echo $HEART_DISCONNECTED "$charge%"
                fi
                break
            fi
        done
esac<commit_msg>Update segments/battery_mac.sh<commit_after>#!/usr/bin/env bash

HEART_CONNECTED=♥
HEART_DISCONNECTED=♡

case $(uname -s) in
    "Darwin")
        ioreg -c AppleSmartBattery -w0 | \
        grep -o '"[^"]*" = [^ ]*' | \
        sed -e 's/= //g' -e 's/"//g' | \
        sort | \
        while read key value; do
            case $key in
                "MaxCapacity")
                    export maxcap=$value;;
                "CurrentCapacity")
                    export curcap=$value;;
                "ExternalConnected")
                    export extconnect=$value;;
            esac
            if [[ -n $maxcap && -n $curcap && -n $extconnect ]]; then
                if [[ "$curcap" == "$maxcap" ]]; then
                    exit
                fi
                charge=$(( 100 * $curcap / $maxcap ))
                if [[ "$extconnect" == "Yes" ]]; then
                    echo $HEART_CONNECTED "$charge%"
                else
                    if [[ $charge -lt 50 ]]; then
                        echo -n "#[fg=red]"
                    fi
                    echo $HEART_DISCONNECTED "$charge%"
                fi
                break
            fi
        done
esac
{'fraction_non_alphanumeric': 0.13220338983050847, 'fraction_numerical': 0.005084745762711864, 'mean_word_length': 1.0266094420600858, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6165555', 'n_tokens_mistral': 708, 'n_tokens_neox': 653, 'n_words': 167}