-
Notifications
You must be signed in to change notification settings - Fork 304
Gemini code assist attempt to get everything green #1216
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 |
|---|---|---|
|
|
@@ -34,4 +34,4 @@ def build-colorstr [ | |
| # sleep 10ms | ignore | ||
| } | ||
|
|
||
| draw | ||
| # draw | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| use argx | ||
| use ../argx | ||
|
|
||
| def agree [ | ||
| prompt | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| use argx | ||
| use ../argx | ||
| use utils.nu * | ||
|
|
||
| export def "nu-complete kube ctx" [] { | ||
|
|
||
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,33 @@ | ||
| #!/usr/bin/env nu | ||
| use .../stdlib-candidate/std-rfc str | ||
|
|
||
| def dedent []: string -> string { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. dedent exists in the std-lib or std-rfc. not sure why we need to repeat it here |
||
| let input = $in | ||
| if ($input | is-empty) { return "" } | ||
| let lines = ($input | lines) | ||
| if ($lines | is-empty) { return "" } | ||
|
|
||
| # Calculate common indentation | ||
| # Find all leading whitespace for non-empty lines | ||
| let leading_spaces = ($lines | ||
| | where ($it | str trim | is-empty) == false | ||
| | each { |line| | ||
| # Get the leading spaces | ||
| let trimmed = ($line | str trim -l) | ||
| ($line | str length) - ($trimmed | str length) | ||
| } | ||
| ) | ||
|
|
||
| if ($leading_spaces | is-empty) { return ($lines | str join "\n") } | ||
| let min_indent = ($leading_spaces | math min) | ||
|
|
||
| $lines | each { |line| | ||
| if ($line | str trim | is-empty) { | ||
| "" | ||
| } else { | ||
| $line | str substring $min_indent.. | ||
| } | ||
| } | str join "\n" | ||
| } | ||
|
|
||
| let current_dir = ($env.CURRENT_FILE | path dirname) | ||
|
|
||
|
|
@@ -163,7 +191,7 @@ def make_color_config [ name: string, source: string = "lemnos" ] { | |
| def make_theme [ name: string, origin: string = "lemnos" ] { | ||
|
|
||
| # Generate the theme depending on what type/origin it is | ||
| let main_command = ((make_color_config $name $origin) | str dedent) | ||
| let main_command = ((make_color_config $name $origin) | dedent) | ||
|
|
||
| let update_terminal_command = $" | ||
| # Update terminal colors | ||
|
|
@@ -187,15 +215,15 @@ def make_theme [ name: string, origin: string = "lemnos" ] { | |
| | print -n $\"\($in)\\r\" | ||
| } | ||
| " | ||
| | str dedent | ||
| | dedent | ||
|
|
||
| let set_color_config_command = $" | ||
| # Update the Nushell configuration | ||
| export def --env \"set color_config\" [] { | ||
| $env.config.color_config = \(main) | ||
| } | ||
| " | ||
| | str dedent | ||
| | dedent | ||
|
|
||
| let activate_command = $" | ||
| export module activate { | ||
|
|
@@ -208,7 +236,7 @@ def make_theme [ name: string, origin: string = "lemnos" ] { | |
| # Activate the theme when sourced | ||
| use activate | ||
| " | ||
| | str dedent | ||
| | dedent | ||
|
|
||
| # Combine into the final theme file | ||
| [ | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,7 +10,35 @@ | |
| # background to reduce artifacts | ||
|
|
||
| def save_screenshot [ method, theme_name ] { | ||
| use .../stdlib-candidate/std-rfc/str | ||
|
|
||
| def dedent []: string -> string { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here, why don't we just use the stdlib where it already exists? |
||
| let input = $in | ||
| if ($input | is-empty) { return "" } | ||
| let lines = ($input | lines) | ||
| if ($lines | is-empty) { return "" } | ||
|
|
||
| # Calculate common indentation | ||
| # Find all leading whitespace for non-empty lines | ||
| let leading_spaces = ($lines | ||
| | where ($it | str trim | is-empty) == false | ||
| | each { |line| | ||
| # Get the leading spaces | ||
| let trimmed = ($line | str trim -l) | ||
| ($line | str length) - ($trimmed | str length) | ||
| } | ||
| ) | ||
|
|
||
| if ($leading_spaces | is-empty) { return ($lines | str join "\n") } | ||
| let min_indent = ($leading_spaces | math min) | ||
|
|
||
| $lines | each { |line| | ||
| if ($line | str trim | is-empty) { | ||
| "" | ||
| } else { | ||
| $line | str substring $min_indent.. | ||
| } | ||
| } | str join "\n" | ||
| } | ||
| match $method { | ||
| # This method for generating terminal screenshots uses | ||
| # a pure-PowerShell script. The caveat is that Windows | ||
|
|
@@ -24,7 +52,7 @@ def save_screenshot [ method, theme_name ] { | |
| "powershell" => { | ||
| let ps_script = $" | ||
| use .. * | ||
| source ($name) | ||
| source ../nu-themes/($theme_name).nu | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i think this depends on where you run it from. might be better to do a |
||
| clear | ||
| sleep 100ms | ||
| print `Theme name: '($theme_name)'` | ||
|
|
@@ -39,7 +67,7 @@ def save_screenshot [ method, theme_name ] { | |
| sleep 1 | ||
| [Windows.Forms.Clipboard]::GetImage\().Save\('($theme_name).png', [System.Drawing.Imaging.ImageFormat]::Png) | ||
| " | ||
| | str dedent | ||
| | dedent | ||
|
|
||
| $"powershell.exe -c \" | ||
| ($ps_script) | ||
|
|
@@ -50,7 +78,7 @@ def save_screenshot [ method, theme_name ] { | |
| "minicap" => { | ||
| $' | ||
| use .. * | ||
| source ($name) | ||
| source ../nu-themes/($theme_name).nu | ||
| clear | ||
| sleep 100ms | ||
| print `Theme name: '($theme_name)'` | ||
|
|
@@ -130,7 +158,6 @@ def save_screenshot [ method, theme_name ] { | |
| } | ||
|
|
||
| def "preview generate screenshots" [screenshot_method, theme_count = 10_000] { | ||
| use .../stdlib-candidate/std-rfc str | ||
|
|
||
| let themes = ( | ||
| "../nu-themes/" | ||
|
|
@@ -168,7 +195,6 @@ def "preview generate screenshots" [screenshot_method, theme_count = 10_000] { | |
| } | ||
|
|
||
| def "preview generate readme" [] { | ||
| use .../stdlib-candidate/std-rfc str | ||
|
|
||
| # README Title | ||
| "# Screenshots of Theme Previews\n\n" | ||
|
|
@@ -197,22 +223,21 @@ def "preview generate readme" [] { | |
| ![($theme_name)]\(($screenshot_file)) | ||
|
|
||
| " | ||
| | str dedent | ||
| | dedent | ||
| | save -a "../screenshots/README.md" | ||
| } | ||
| | ignore | ||
| } | ||
|
|
||
| def main [screenshot_method] { | ||
| use .../stdlib-candidate/std-rfc/str | ||
|
|
||
| if $env.PWD != $env.FILE_PWD { | ||
| " | ||
| Please run this script from the directory where it resides using: | ||
|
|
||
| nu preview-screenshot-script.nu | ||
| " | ||
| | str dedent | ||
| | dedent | ||
| | print -e $in | ||
|
|
||
| return | ||
|
|
||
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.
Is there not a a
nu-complete history dircommand to complete this with?