Skip to content

Conversation

FrancescElies
Copy link
Contributor

@FrancescElies FrancescElies commented May 1, 2025

github stars listing was wrong because humanized date strings were being sorted instead datetime objects.

Ref. #1109 (comment)

@fdncred
Copy link
Contributor

fdncred commented May 1, 2025

Thanks. I'm good with landing this but I wanted to mention also that I've also seen such a thing stream with the generate command. I'm not sure if this works but I had this stashed away to demonstrate what I'm saying. It probably came from someone in our Discord chat.

# Example of how to use generate to grab paginated data from github
def gen_gh [] {
  let PAGE_SIZE = 10

  generate {|page = 1|
    let resp = http get --headers [Authorization <gh pat>] (
    {
      scheme: https,
      host: "api.github.com",
      path: "/repos/nushell/nushell/issues",
      params: {
      page: $page,
      per_page: $PAGE_SIZE
      }
    } | url join)

    if ($resp | length) < $PAGE_SIZE {
      {out: $resp}
    } else {
      {out: $resp, next: ($page + 1)}
    }
  }
}

@fdncred fdncred merged commit 5e732da into nushell:main May 1, 2025
1 check passed
@FrancescElies FrancescElies deleted the cesc/gh-my-stars branch May 8, 2025 19:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants