Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 16 additions & 9 deletions make_release/20k_club.nu
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,22 @@ def get_pr_counts [debug_csv: bool, repos_root_folder = '/Users/fdncred/src'] {
append (open vscode.csv)
)

let data_polars = ($data | polars into-df)
$data_polars |
polars group-by name |
polars agg [(polars col commits | polars sum | polars as "all_commits")] |
polars collect |
polars sort-by all_commits |
polars reverse |
polars into-nu |
first 75
# let data_polars = ($data | polars into-df)
# $data_polars |
# polars group-by name |
# polars agg [(polars col commits | polars sum | polars as "all_commits")] |
# polars collect |
# polars sort-by all_commits |
# polars reverse |
# polars into-nu |
# first 75
$data |
group-by name --to-table |
upsert all_commits {|r| $r.items.commits | math sum } |
reject items |
sort-by all_commits --reverse |
first 75 |
to csv
}
}

Expand Down
29 changes: 15 additions & 14 deletions modules/coloring/color_table.nu
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def make_header [hi] {
let ansi105m = ('105m' | fill -a l -w 9 -c ' ')
let ansi106m = ('106m' | fill -a l -w 9 -c ' ')
let ansi107m = ('107m' | fill -a l -w 9 -c ' ')
$"(char newline)($ansi100m)($ansi101m)($ansi102m)($ansi103m)($ansi104m)($ansi105m)($ansi106m)($ansi107m)(char newline)"
$"(char newline) ($ansi100m)($ansi101m)($ansi102m)($ansi103m)($ansi104m)($ansi105m)($ansi106m)($ansi107m)(char newline)"

} else {
let ansi40m = ('40m' | fill -a l -w 10 -c ' ')
Expand All @@ -19,7 +19,8 @@ def make_header [hi] {
let ansi45m = ('45m' | fill -a l -w 8 -c ' ')
let ansi46m = ('46m' | fill -a l -w 8 -c ' ')
let ansi47m = ('47m' | fill -a l -w 8 -c ' ')
$"(char newline)($ansi40m)($ansi41m)($ansi42m)($ansi43m)($ansi44m)($ansi45m)($ansi46m)($ansi47m)(char newline)"
let ansi49m = ('49m' | fill -a l -w 8 -c ' ')
$"(char newline) ($ansi40m)($ansi41m)($ansi42m)($ansi43m)($ansi44m)($ansi45m)($ansi46m)($ansi47m)($ansi49m)(char newline)"
}
}

Expand All @@ -34,58 +35,58 @@ def mk_header [color_range:range] {
let lo_start_pad = 10
let lo_regular_pad = 8
echo $color_range | each { |color|
if $color != 48 {
let ansi_color = $"($color)m"
if $color == $min_rng {
if $min_rng == 100 {
($ansi_color | fill -a l -w $hi_start_pad -c ' ')

} else {
($ansi_color | fill -a l -w $lo_start_pad -c ' ')

}

} else {
if $min_rng >= 100 {
($ansi_color | fill -a l -w $hi_regular_pad -c ' ')

} else {
($ansi_color | fill -a l -w $lo_regular_pad -c ' ')

}

}
} | str join
}
} | str join
echo (char newline)
}

def color_row_range [num:int bg_rg:range] {
let reset = (ansi reset)
let row_header = $"($num)m ($reset)"
let row_data = (echo $bg_rg | each { |back|
if $back != 48 {
let row_name = $"($num);($back)m"
let ansi_color = (ansi -e $row_name)
$"($ansi_color) ($row_name) ($reset)"
}
} | append (char newline) | str join)
$"($row_header)($row_data)"
}

def create_color_tables [fg_range:range bg_range:range] {
echo $fg_range | each { |fg|
if $fg != 38 {
color_row_range $fg $bg_range
}
} | str join
}

def color_table [] {
[
# make_header $false
(mk_header 40..47)
(create_color_tables 30..37 40..47)
(make_header false)
# (mk_header 40..49)
(create_color_tables 30..39 40..49)

# put a line between tables
(char newline)

#make_header $true
(mk_header 100..107)
(make_header true)
# (mk_header 100..107)
Comment on lines +81 to +89
Copy link

Copilot AI Dec 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Inconsistent use of header functions: both make_header and mk_header are defined but only make_header is being used (lines 81, 88), while mk_header calls are commented out (lines 82, 89). Consider removing the unused mk_header function or documenting why both are kept, as noted in the comment on lines 27-29.

Copilot uses AI. Check for mistakes.
(create_color_tables 90..97 100..107)
] | str join
}
Expand Down
7 changes: 5 additions & 2 deletions modules/coloring/color_tables.nu
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,13 @@
# echo ""

0..8 | each {|x|
let row = (30..37 | each {|i|
let row = (40..47 | each {|a|
let row = (30..39 | each {|i|
let row = (40..49 | each {|a|
if ($a != 48) {
if ($i != 38) {
Copy link

Copilot AI Dec 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent indentation: the inner if statement on line 17 should be indented to match the nesting level inside the outer if block. The code block on lines 18-19 is correctly indented relative to the second if, but line 17 itself appears to be at the wrong indentation level.

Suggested change
if ($i != 38) {
if ($i != 38) {

Copilot uses AI. Check for mistakes.
let color = $"($x);($i);($a)"
$"(ansi -e $color)m\\e[($color)(ansi -e '0;37;40')m "
}}
} | str join)
$"($row)(char newline)"
} | str join)
Expand Down
56 changes: 35 additions & 21 deletions modules/coloring/sample.nu
Original file line number Diff line number Diff line change
@@ -1,25 +1,39 @@
# Background Colors
[40..47 100..107 49] | each { flatten } | flatten | each { |clbg|
# Foreground Colors
[30..37 90..97 39] | each { flatten } | flatten | each { |clfg|
# 0 Normal
# 1 Bold or increased intensity
# 2 Faint or decreased intensity
# 3 Italic (not widely supported)
# 4 Underline
# 5 Slow Blink < 150 per minute
# 6 Rapid Blink > 150 per minute
# 7 Reverse Video
# 8 Conceal (not widely supported)
# 9 Strike-through
let row = (0..9 | each { |attr|
let ansi_str = $"($attr);($clbg);($clfg)m"
$"(ansi -e $ansi_str) ($ansi_str) (ansi reset)"
} | str join)
$"($row)(char newline)"
} | str join
} | str join
def "into list" []: any -> list {
let input = $in
let type = ($input | describe --detailed | get type)
match $type {
range => {$input | each {||}}
Copy link

Copilot AI Dec 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The empty closure {||} on line 5 is an unusual way to convert a range to a list. Consider using a more idiomatic approach such as each {|x| $x} or wrapping the range in a list: [$input] (for single ranges) or using the range directly since most nushell commands automatically enumerate ranges. The current syntax may work but is not conventional.

Suggested change
range => {$input | each {||}}
range => {$input | each {|x| $x}}

Copilot uses AI. Check for mistakes.
list => $input
table => $input
record => {$input | transpose -d key value}
_ => [ $input ]
}
}

def print_sample [] {
# Background Colors
[40..47 49 100..107] | each { into list } | flatten | each { |clbg|
Copy link

Copilot AI Dec 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The order of background colors has changed from the bash reference implementation. The bash script (line 48) iterates as {40..47} {100..107} 49 (ranges 40-47, 100-107, then 49), but the new code on line 15 uses [40..47 49 100..107] (ranges 40-47, value 49, then 100-107). This will produce output in a different order. If the order matters for the expected output, consider reordering to match: [40..47 100..107 49].

Suggested change
[40..47 49 100..107] | each { into list } | flatten | each { |clbg|
[40..47 100..107 49] | each { into list } | flatten | each { |clbg|

Copilot uses AI. Check for mistakes.
# Foreground Colors
[30..37 39 90..97] | each { into list } | flatten | each { |clfg|
Copy link

Copilot AI Dec 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The order of foreground colors has changed from the bash reference implementation. The bash script (line 50) iterates as {30..37} {90..97} 39 (ranges 30-37, 90-97, then 39), but the new code uses [30..37 39 90..97] (ranges 30-37, value 39, then 90-97). This will produce output in a different order. If the order matters for the expected output, consider reordering to match: [30..37 90..97 39].

Suggested change
[30..37 39 90..97] | each { into list } | flatten | each { |clfg|
[30..37 90..97 39] | each { into list } | flatten | each { |clfg|

Copilot uses AI. Check for mistakes.
# 0 Normal
# 1 Bold or increased intensity
# 2 Faint or decreased intensity
# 3 Italic (not widely supported)
# 4 Underline
# 5 Slow Blink < 150 per minute
# 6 Rapid Blink > 150 per minute
# 7 Reverse Video
# 8 Conceal (not widely supported)
# 9 Strike-through
let row = (0..9 | each { |attr|
let ansi_str = $"($attr);($clbg);($clfg)m"
$"(ansi -e $ansi_str) ($ansi_str) (ansi reset)"
} | str join)
$"($row)(char newline)"
} | str join
} | str join
}
print_sample
Copy link

Copilot AI Dec 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Trailing whitespace after the function call. Remove the space after print_sample.

Suggested change
print_sample
print_sample

Copilot uses AI. Check for mistakes.
# Bash Script

# #!/bin/bash
Expand Down
10 changes: 5 additions & 5 deletions modules/prompt/oh-my.nu
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@

# Abbreviate home path
def home_abbrev [os_name] {
let is_home_in_path = ($env.PWD | str starts-with $nu.home-path)
let is_home_in_path = ($env.PWD | str starts-with $nu.home-dir)
if $is_home_in_path {
if ($os_name =~ "windows") {
let home = ($nu.home-path | str replace -ar '\\' '/')
let home = ($nu.home-dir | str replace -ar '\\' '/')
let pwd = ($env.PWD | str replace -ar '\\' '/')
$pwd | str replace $home '~'
} else {
$env.PWD | str replace $nu.home-path '~'
$env.PWD | str replace $nu.home-dir '~'
}
} else {
if ($os_name =~ "windows") {
Expand All @@ -39,7 +39,7 @@ def path_abbrev_if_needed [apath term_width] {
let P = (ansi { fg: "#E4E4E4" bg: "#3465A4" }) # path
let PB = (ansi { fg: "#E4E4E4" bg: "#3465A4" attr: b }) # path bold
let R = (ansi reset)
let is_home_in_path = ($env.PWD | str starts-with $nu.home-path)
let is_home_in_path = ($env.PWD | str starts-with $nu.home-dir)

if (($apath | str length) > ($term_width / 2)) {
# split out by path separator into tokens
Expand Down Expand Up @@ -325,7 +325,7 @@ def git_left_prompt [gs os] {
] | str join
)

let is_home_in_path = ($env.PWD | str starts-with $nu.home-path)
let is_home_in_path = ($env.PWD | str starts-with $nu.home-dir)
let path_segment = (
if (($is_home_in_path) and ($branch_name == "")) {
[
Expand Down