-
Notifications
You must be signed in to change notification settings - Fork 300
some tweaks for a variety of scripts #1191
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -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) { | ||||||
|
||||||
| if ($i != 38) { | |
| if ($i != 38) { |
| 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 {||}} | ||||||
|
||||||
| range => {$input | each {||}} | |
| range => {$input | each {|x| $x}} |
Copilot
AI
Dec 9, 2025
There was a problem hiding this comment.
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].
| [40..47 49 100..107] | each { into list } | flatten | each { |clbg| | |
| [40..47 100..107 49] | each { into list } | flatten | each { |clbg| |
Copilot
AI
Dec 9, 2025
There was a problem hiding this comment.
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].
| [30..37 39 90..97] | each { into list } | flatten | each { |clfg| | |
| [30..37 90..97 39] | each { into list } | flatten | each { |clfg| |
Copilot
AI
Dec 9, 2025
There was a problem hiding this comment.
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.
| print_sample | |
| print_sample |
There was a problem hiding this comment.
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_headerandmk_headerare defined but onlymake_headeris being used (lines 81, 88), whilemk_headercalls are commented out (lines 82, 89). Consider removing the unusedmk_headerfunction or documenting why both are kept, as noted in the comment on lines 27-29.