Skip to content

[FEAT] year option in formats under the disk module #1847

@Kingproone

Description

@Kingproone

Description

I like that for some time there is a way to display days since install built in with the {days} variable, but I'd like to see this in years.
Maybe there is a way to do this with the available options that I have yet to discover, in the meantime I have a huge spagetti that does this:

    {
        "type": "command",
        "key": "   System  ",
        "text": "birth_install=$(stat -c %W / 2>/dev/null || stat -f %B / 2>/dev/null); if [ -z \"$birth_install\" ] || [ \"$birth_install\" -eq 0 ]; then birth_install=$(find / -maxdepth 0 -printf '%T@' 2>/dev/null); fi; current=$(date +%s); time_progression=$((current - birth_install)); days_difference=$((time_progression / 86400)); years_difference=$(awk \"BEGIN {printf \\\"%.2f\\\", $days_difference/365}\"); echo \"$years_difference years ($days_difference days)\"",
        "keyColor": "white"
    },

output:
System 1.58 years (576 days)

with the {year} it could look something like
{
"type": "disk",
"key": "Os Age",
"folders": "/",
"format": "{years} years",
},
this would only show the year, to show the days it was calculated from after it, like the spaghetti, #482 would need resolving
"format": "{years} years {days} days", would probably say the year and the remaining days, and not a rational number

Motivation

clean up the huge spaghetti I have to something leaner

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions