dlvhdr / gh-dash

A beautiful CLI dashboard for GitHub 🚀
https://dlvhdr.github.io/gh-dash
MIT License
6.77k stars 191 forks source link

Provide time to filters as Go template #375

Open polds opened 1 month ago

polds commented 1 month ago

Is your feature request related to a problem? Please describe. I would like to create filters for "stale" or "fresh" issues using Github's created: and updated: filters. Github does not allow relative durations but require a ISO_8601 date (with optional additional timestamp) docs.

Due to the requirement of having an absolute timestamp, it's not possible to create a filter that shows PRs created in the last week, or older than a month, etc.

Describe the solution you'd like Filters are passed through Go's template engine, "now" is provided, along with a duration parsing method. An example could be something like now, date, and dateModify from slim-sprig which would theoretically enable something like this:

- title: Stale PRs
  filters: >-
    is:open
    review-requested:@me
    updated:<={{ now | date_modify "-30d" | date "2006-01-02" }}

I imagine an edge case with a solution like this is the filters would need to be reevaluted during every refetchIntervalMinutes and not computed on dashboard inititialization.

Describe alternatives you've considered I'm not aware of this being feasible beyond maybe automating the date adjustments in the config.

Additional context N/A