diff --git a/make_release/20k_club.nu b/make_release/20k_club.nu index ca5244de5..0018df0fb 100644 --- a/make_release/20k_club.nu +++ b/make_release/20k_club.nu @@ -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 } } diff --git a/modules/coloring/color_table.nu b/modules/coloring/color_table.nu index a7d3327a0..1a942e83d 100644 --- a/modules/coloring/color_table.nu +++ b/modules/coloring/color_table.nu @@ -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 ' ') @@ -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)" } } @@ -34,27 +35,23 @@ 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) } @@ -62,30 +59,34 @@ 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) (create_color_tables 90..97 100..107) ] | str join } diff --git a/modules/coloring/color_tables.nu b/modules/coloring/color_tables.nu index 42b4fc23e..d4cb13cb3 100644 --- a/modules/coloring/color_tables.nu +++ b/modules/coloring/color_tables.nu @@ -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) { let color = $"($x);($i);($a)" $"(ansi -e $color)m\\e[($color)(ansi -e '0;37;40')m " + }} } | str join) $"($row)(char newline)" } | str join) diff --git a/modules/coloring/sample.nu b/modules/coloring/sample.nu index 29deda12e..688729c78 100644 --- a/modules/coloring/sample.nu +++ b/modules/coloring/sample.nu @@ -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 {||}} + 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| + # Foreground Colors + [30..37 39 90..97] | each { into list } | 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 +} +print_sample # Bash Script # #!/bin/bash diff --git a/modules/prompt/oh-my.nu b/modules/prompt/oh-my.nu index bf4126d15..387887360 100644 --- a/modules/prompt/oh-my.nu +++ b/modules/prompt/oh-my.nu @@ -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") { @@ -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 @@ -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 == "")) { [