Skip to content

Scripting is More Fun With Nushell

There are multiple ways to improve your experience in the terminal. You can get a nice prompt with starship. On Linux and macOS, you can switch to the fish shell. A lot of nice things like syntax highlighting, tab completion with help text and inline suggestions simply work out of the box.

However, I went for Nushell. Unlike fish, Nu also works on Windows. Nuโ€™s interactive experience is nearly as nice as fishโ€™s out-of-the-box and just as nice with a few configuration tweaks. Since I donโ€™t use Windows as my daily driver that shouldnโ€™t matter all that much to me, but it can be an extra benefit.

Another common way of use case of shells is for scripting. After experimenting with commands in your terminal, you put the very same commands in a text file. In the case of Nu, you then execute that script with nu script.nu. This is the workflow where shells shine, and Nu is a prime example for that.

So letโ€™s take a look at the pitch on Nuโ€™s homepage:

Nu pipelines use structured data so you can safely select, filter, and sort the same way every time. Stop parsing strings and start solving problems.

When I first read this, it didnโ€™t really resonate with me. Maybe I didnโ€™t write enough shell scripts at that time.

Letโ€™s look at a non-trivial example to find out why itโ€™s a big deal that Nu deals with structured data. Some GitHub repositories like Zedโ€™s have an issue that shows the issues with the highest number of ๐Ÿ‘ reactions created within in the last week.

We will now do the same with the help of Nushell.

I will use the Pixi repository, but any other repository with enough community engagement will do as well.

Terminal window
let repo = "prefix-dev/pixi"

Many modern CLI tools have a JSON interface and gh is not different. We need the following fields:

  • createdAt so we only take the ones from last week
  • reactionGroups so we can extract the ๐Ÿ‘ reactions
  • title and url to display them later

In the end we will get a list of records also known as a table. Each record represents one issue, and we pick one in order to get familiar with the structure. Please note that this will return a different issue for you, since more issues will have been opened on this repo by the time you read this.

Terminal window
gh issue list --repo $repo --json createdAt,reactionGroups,title,url
| from json
| get 1
โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ createdAt โ”‚ 2025-08-29T13:11:13Z โ”‚
โ”‚ โ”‚ โ•ญโ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ โ”‚
โ”‚ reactionGroups โ”‚ โ”‚ # โ”‚ content โ”‚ users โ”‚ โ”‚
โ”‚ โ”‚ โ”œโ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค โ”‚
โ”‚ โ”‚ โ”‚ 0 โ”‚ THUMBS_UP โ”‚ โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ•ฎ โ”‚ โ”‚
โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ totalCount โ”‚ 1 โ”‚ โ”‚ โ”‚
โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ•ฏ โ”‚ โ”‚
โ”‚ โ”‚ โ•ฐโ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ โ”‚
โ”‚ title โ”‚ Ability to split pixi.lock (not toml!) into multiple files โ”‚
โ”‚ url โ”‚ https://github.com/prefix-dev/pixi/issues/4467 โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

Notice that Nu pretty prints the record per default.

Nu also has first class support for datetime objects. This makes it easy to only take the rows of our table where createdAt falls within the last week.

Terminal window
gh issue list --repo $repo --json createdAt,reactionGroups,title,url
| from json
| where ($it.createdAt | into datetime) >= (date now) - 1wk
| get createdAt
| last 5
โ•ญโ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ 0 โ”‚ 2025-08-25T11:28:37Z โ”‚
โ”‚ 1 โ”‚ 2025-08-25T10:19:22Z โ”‚
โ”‚ 2 โ”‚ 2025-08-25T10:07:58Z โ”‚
โ”‚ 3 โ”‚ 2025-08-25T07:21:52Z โ”‚
โ”‚ 4 โ”‚ 2025-08-24T17:00:35Z โ”‚
โ•ฐโ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

We took the last 5 elements. Considering that this blog has been written on August 31st, these results seem pretty reasonable.

We donโ€™t have a nice way to extract the ๐Ÿ‘ reactions yet, so letโ€™s work on that. As a reminder, thatโ€™s how reactionGroup value looks like for the issue we looked at originally.

Terminal window
gh issue list --repo $repo --json createdAt,reactionGroups,title,url
| from json
| where ($it.createdAt | into datetime) >= (date now) - 1wk
| get 1
| get reactionGroups
โ•ญโ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ # โ”‚ content โ”‚ users โ”‚
โ”œโ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ 0 โ”‚ THUMBS_UP โ”‚ โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ•ฎ โ”‚
โ”‚ โ”‚ โ”‚ โ”‚ totalCount โ”‚ 1 โ”‚ โ”‚
โ”‚ โ”‚ โ”‚ โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ•ฏ โ”‚
โ•ฐโ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

This issue, however, does not have reactions at all.

Terminal window
gh issue list --repo $repo --json createdAt,reactionGroups,title,url
| from json
| where ($it.createdAt | into datetime) >= (date now) - 1wk
| get 0
| get reactionGroups
โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ empty list โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

Letโ€™s insert a new column thumbsUp, which is based on the column reactionGroup. Of this reaction table, it only takes rows with THUMBS_UP reaction. Rows that donโ€™t have any THUMBS_UP reactions will result in an empty list.

Terminal window
gh issue list --repo $repo --json createdAt,reactionGroups,title,url
| from json
| where ($it.createdAt | into datetime) >= (date now) - 1wk
| insert thumbsUp {
$in.reactionGroups
| where content == THUMBS_UP
}
| get thumbsUp
| first 5
โ•ญโ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ 0 โ”‚ [list 0 items] โ”‚
โ”‚ 1 โ”‚ โ•ญโ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ โ”‚
โ”‚ โ”‚ โ”‚ # โ”‚ content โ”‚ users โ”‚ โ”‚
โ”‚ โ”‚ โ”œโ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค โ”‚
โ”‚ โ”‚ โ”‚ 0 โ”‚ THUMBS_UP โ”‚ โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ•ฎ โ”‚ โ”‚
โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ totalCount โ”‚ 1 โ”‚ โ”‚ โ”‚
โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ•ฏ โ”‚ โ”‚
โ”‚ โ”‚ โ•ฐโ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ โ”‚
โ”‚ 2 โ”‚ [list 0 items] โ”‚
โ”‚ 3 โ”‚ [list 0 items] โ”‚
โ”‚ 4 โ”‚ โ•ญโ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ โ”‚
โ”‚ โ”‚ โ”‚ # โ”‚ content โ”‚ users โ”‚ โ”‚
โ”‚ โ”‚ โ”œโ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค โ”‚
โ”‚ โ”‚ โ”‚ 0 โ”‚ THUMBS_UP โ”‚ โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ•ฎ โ”‚ โ”‚
โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ totalCount โ”‚ 5 โ”‚ โ”‚ โ”‚
โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ•ฏ โ”‚ โ”‚
โ”‚ โ”‚ โ•ฐโ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ โ”‚
โ•ฐโ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

We care about the total count. We get that by accessing users.totalCount.

Terminal window
gh issue list --repo $repo --json createdAt,reactionGroups,title,url
| from json
| where ($it.createdAt | into datetime) >= (date now) - 1wk
| insert thumbsUp {
$in.reactionGroups
| where content == THUMBS_UP
| get users.totalCount
}
| get thumbsUp
| first 5
โ•ญโ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ 0 โ”‚ [list 0 items] โ”‚
โ”‚ 1 โ”‚ โ•ญโ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ•ฎ โ”‚
โ”‚ โ”‚ โ”‚ 0 โ”‚ 1 โ”‚ โ”‚
โ”‚ โ”‚ โ•ฐโ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ•ฏ โ”‚
โ”‚ 2 โ”‚ [list 0 items] โ”‚
โ”‚ 3 โ”‚ [list 0 items] โ”‚
โ”‚ 4 โ”‚ โ•ญโ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ•ฎ โ”‚
โ”‚ โ”‚ โ”‚ 0 โ”‚ 5 โ”‚ โ”‚
โ”‚ โ”‚ โ•ฐโ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ•ฏ โ”‚
โ•ฐโ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

Some rows now have empty lists, and some have lists containing a single entry: the number of ๐Ÿ‘ reactions. With get 0 we get the first element of a list. By adding --optional, this command doesnโ€™t fail on empty lists but returns null instead. We replace null with 0, by running default 0.

Terminal window
gh issue list --repo $repo --json createdAt,reactionGroups,title,url
| from json
| where ($it.createdAt | into datetime) >= (date now) - 1wk
| insert thumbsUp {
$in.reactionGroups
| where content == THUMBS_UP
| get users.totalCount
| get 0 --optional
| default 0
}
| get thumbsUp
| first 5
โ•ญโ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ•ฎ
โ”‚ 0 โ”‚ 0 โ”‚
โ”‚ 1 โ”‚ 1 โ”‚
โ”‚ 2 โ”‚ 0 โ”‚
โ”‚ 3 โ”‚ 0 โ”‚
โ”‚ 4 โ”‚ 5 โ”‚
โ•ฐโ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ•ฏ

The three columns we truly care about are thumbsUp, title and url, so letโ€™s select those. We also sort the table, so that the issues with the most ๐Ÿ‘ reactions come first.

Terminal window
gh issue list --repo $repo --json createdAt,reactionGroups,title,url
| from json
| where ($it.createdAt | into datetime) >= (date now) - 1wk
| insert thumbsUp {
$in.reactionGroups
| where content == THUMBS_UP
| get users.totalCount
| get 0 --optional
| default 0
}
| select thumbsUp title url
| sort-by --reverse thumbsUp
| first 5
โ•ญโ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ # โ”‚ thumbsUp โ”‚ title โ”‚ url โ”‚
โ”œโ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ 0 โ”‚ 5 โ”‚ Proposal to allow the use of Pixi workspaces through a named registry of workspaces โ”‚ https://github.com/prefix-dev/pixi/issues/4461 โ”‚
โ”‚ 1 โ”‚ 1 โ”‚ pixi-build: load variants from packages or files โ”‚ https://github.com/prefix-dev/pixi/issues/4429 โ”‚
โ”‚ 2 โ”‚ 1 โ”‚ `pixi run echo '{{ hello }}'` fails โ”‚ https://github.com/prefix-dev/pixi/issues/4432 โ”‚
โ”‚ 3 โ”‚ 1 โ”‚ Environment variable of tasks are broken when defined inside task โ”‚ https://github.com/prefix-dev/pixi/issues/4451 โ”‚
โ”‚ 4 โ”‚ 1 โ”‚ Documentation: Add switchable pyproject.toml / pixi.toml code snippets โ”‚ https://github.com/prefix-dev/pixi/issues/4452 โ”‚
โ•ฐโ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

Unicode can be a bit annoying to type in the terminal, but now itโ€™s time to rename our thumbsUp column to ๐Ÿ‘.

Terminal window
gh issue list --repo $repo --json createdAt,reactionGroups,title,url
| from json
| where ($it.createdAt | into datetime) >= (date now) - 1wk
| insert thumbsUp {
$in.reactionGroups
| where content == THUMBS_UP
| get users.totalCount
| get 0 --optional
| default 0
}
| select thumbsUp title url
| sort-by --reverse thumbsUp
| rename --column { thumbsUp: ๐Ÿ‘ }
| first 5
โ•ญโ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ # โ”‚ ๐Ÿ‘ โ”‚ title โ”‚ url โ”‚
โ”œโ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ 0 โ”‚ 5 โ”‚ Proposal to allow the use of Pixi workspaces through a named registry of workspaces โ”‚ https://github.com/prefix-dev/pixi/issues/4461 โ”‚
โ”‚ 1 โ”‚ 1 โ”‚ pixi-build: load variants from packages or files โ”‚ https://github.com/prefix-dev/pixi/issues/4429 โ”‚
โ”‚ 2 โ”‚ 1 โ”‚ `pixi run echo '{{ hello }}'` fails โ”‚ https://github.com/prefix-dev/pixi/issues/4432 โ”‚
โ”‚ 3 โ”‚ 1 โ”‚ Environment variable of tasks are broken when defined inside task โ”‚ https://github.com/prefix-dev/pixi/issues/4451 โ”‚
โ”‚ 4 โ”‚ 1 โ”‚ Documentation: Add switchable pyproject.toml / pixi.toml code snippets โ”‚ https://github.com/prefix-dev/pixi/issues/4452 โ”‚
โ•ฐโ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

In the end, we want to add this table to the body of a GitHub issue. Luckily, Nu has integrated support to convert its values to Markdown.

Terminal window
let top_issues_week = gh issue list --repo $repo --json createdAt,reactionGroups,title,url
| from json
| where ($it.createdAt | into datetime) >= (date now) - 1wk
| insert thumbsUp {
$in.reactionGroups
| where content == THUMBS_UP
| get users.totalCount
| get 0 --optional
| default 0
}
| select thumbsUp title url
| sort-by --reverse thumbsUp
| rename --column { thumbsUp: ๐Ÿ‘ }
| first 5
| to md

What you can see here is the Markdown table directly embedded in this post, which is also written in Markdown.

๐Ÿ‘titleurl
5Proposal to allow the use of Pixi workspaces through a named registry of workspaceshttps://github.com/prefix-dev/pixi/issues/4461
1pixi-build: load variants from packages or fileshttps://github.com/prefix-dev/pixi/issues/4429
1pixi run echo '{{ hello }}' failshttps://github.com/prefix-dev/pixi/issues/4432
1Environment variable of tasks are broken when defined inside taskhttps://github.com/prefix-dev/pixi/issues/4451
1Documentation: Add switchable pyproject.toml / pixi.toml code snippetshttps://github.com/prefix-dev/pixi/issues/4452

Now we can create an issue with the table we just generated.

Terminal window
gh issue create --title "Top issues last week" --body $top_issues_week

How to update an existing issue is left as an exercise to the reader.

I hope I convinced you that scripting with Nushell can be a lot of fun. Itโ€™s quick to type like bash, and has proper data types like Python.

With Nu, itโ€™s easy to interact with your data: you extend your pipeline until you are happy with what it does.

Many thanks to Sabrina and Lucas for their comments and suggestions on this article

You can find the discussion at this Mastodon post.