Skip to content
Closed
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
2 changes: 1 addition & 1 deletion modules/coloring/24bit-1.nu
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ def build-colorstr [
# sleep 10ms | ignore
}

draw
# draw
2 changes: 1 addition & 1 deletion modules/coloring/short_list.nu
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
source ../stdlib_candidate/nu_style.nu
source ../../stdlib-candidate-archive/stdlib-candidate-older/std-rfc/nu_style.nu

# # Regular Colors
$" Regular Colors (char newline) (char newline)"
Expand Down
2 changes: 1 addition & 1 deletion modules/gitv2/mod.nu
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use argx
use ../argx

def agree [
prompt
Expand Down
2 changes: 1 addition & 1 deletion modules/history-utils/mod.nu
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export def 'history top' [
num=10
--before (-b): duration
--dir (-d)
--path(-p): list<string@"nu-complete history dir">
--path(-p): list<string>
Copy link
Contributor

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 dir command to complete this with?

] {
open $nu.history-path | query db (sql {
from: history
Expand Down
2 changes: 1 addition & 1 deletion modules/kubernetes/complete.nu
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" [] {
Expand Down
2 changes: 1 addition & 1 deletion modules/kubernetes/helm.nu
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use complete.nu *
use utils.nu *
use argx
use ../argx

export def record-to-set-json [value] {
$value | transpose k v
Expand Down
4 changes: 2 additions & 2 deletions modules/kubernetes/resources.nu
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use complete *
use complete.nu *

### refine kubernetes resources
export def kube-refine [
...namespace: string@"nu-complete kube ns"
--kind(-k): list<string>@"nu-complete kube kind"
] {
use lg
use ../lg
let config = $env.KUBERNETES_REFINE

let nsf = if ($namespace | is-empty) {
Expand Down
1 change: 0 additions & 1 deletion modules/language/playground.nu

This file was deleted.

1 change: 0 additions & 1 deletion modules/language/std.nu

This file was deleted.

2 changes: 1 addition & 1 deletion modules/ls_mods/ls-hidden.nu
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

export def ls-hidden [
export def main [
--dir(-d):any # The directory you want to list
] {
let dir = if ($dir | is-empty) { "." } else { $dir }
Expand Down
2 changes: 1 addition & 1 deletion modules/ls_mods/ls-less.nu
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# An attempt at trying to put ls into a paging mode
export def ls-less [
export def main [
--dir(-d):any # The directory you want to list
] {
let is_empty = ($dir | is-empty)
Expand Down
2 changes: 1 addition & 1 deletion modules/ls_mods/ls-wide.nu
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# A ls command that approximates the ls -sh command in bash
export def ls-wide [
export def main [
--path(-p):string # The path you want to list
--columns(-c):int # The number of columns in your output
] {
Expand Down
2 changes: 1 addition & 1 deletion modules/maths/math_functions.nu
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ export def scale-minmax-table [a, b,input?] {
0..($n_cols - 1)
| each {|i|
($x | column2 $i) | scale-minmax $a $b | wrap ($name_cols | get $i)
} | reduce {|it, acc| $acc | merge {$it}}
} | reduce {|it, acc| $acc | merge $it}
}


Expand Down
2 changes: 1 addition & 1 deletion modules/prompt/async_git_prompt/async-git-prompt.nu
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export def async-git-prompt-compute-sync [] {
{ staged: $symbol}
}
# Execute the two slow git commands in parallel and merge the results into a single record
let symbols = ([ $unstaged $staged ] | par-each { |it| do $it } | reduce {|a b| $a | merge {$b}})
let symbols = ([ $unstaged $staged ] | par-each { |it| do $it } | reduce {|a b| $a | merge $b})

$"($symbols | get 'unstaged') ($symbols | get 'staged')" | str trim
}
Expand Down
4 changes: 2 additions & 2 deletions modules/prompt/jalon-git.nu
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ def duration-style [] {

def fast-git-style [] {
let s = get-styles
let b_info = (do -p { git --no-optional-locks branch -v } | str trim)
let b_info = (do -i { git --no-optional-locks branch -v } | str trim)
if ($b_info | is-empty) {
''
} else {
Expand Down Expand Up @@ -190,7 +190,7 @@ def fast-git-style [] {

def full-git-style [] {
let s = get-styles
let info_lines = (do -p { git --no-optional-locks status --porcelain=2 --branch } | str trim | lines)
let info_lines = (do -i { git --no-optional-locks status --porcelain=2 --branch } | str trim | lines)
if ($info_lines | is-empty) {
''
} else {
Expand Down
8 changes: 4 additions & 4 deletions modules/prompt/shell_space.nu
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# use shells to to show workspaces
def workspaces [] {
shells | each {|item index|
if $item.active {
$"(ansi green)($index) "
shells | enumerate | each {|it|
if $it.item.active {
$"(ansi green)($it.index) "
} else {
$"(ansi blue)($index) "
$"(ansi blue)($it.index) "
}
}| str join
}
Expand Down
2 changes: 1 addition & 1 deletion modules/virtual_environments/auto-venv/venv_helpers.nu
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def get-env [
}

export def venv-is-active [] {
'__auto_venv' in (overlay list)
'__auto_venv' in (overlay list | get name)
}

# Creates a virtual environment under the current directory
Expand Down
2 changes: 1 addition & 1 deletion nu-hooks/nu-hooks/dynamic-load/dynamic-load.nu
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
def dynamic_load [] {
[
{
condition: {|before, after| (not ('.nu' in (overlay list))) and ('~/.nu' | path exists) }
condition: {|before, after| (not ('.nu' in (overlay list).name)) and ('~/.nu' | path exists) }
code: "overlay use ~/.nu as .nu"
}
]
Expand Down
3 changes: 2 additions & 1 deletion sourced/todo.nu
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ def --env printer [] {
open $env.TODO
| split row "\n"
| take (($in | length) - 1)
| each {|$it, n| $"($n + 1) (ansi red)->(ansi reset) ($it)"}
| enumerate
| each {|it| $"($it.index + 1) (ansi red)->(ansi reset) ($it.item)"}
| str join "\n"
)

Expand Down
38 changes: 33 additions & 5 deletions themes/src/make.nu
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 {
Copy link
Contributor

Choose a reason for hiding this comment

The 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)

Expand Down Expand Up @@ -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
Expand All @@ -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 {
Expand All @@ -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
[
Expand Down
43 changes: 34 additions & 9 deletions themes/src/preview-generate-screenshots.nu
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,35 @@
# background to reduce artifacts

def save_screenshot [ method, theme_name ] {
use .../stdlib-candidate/std-rfc/str

def dedent []: string -> string {
Copy link
Contributor

Choose a reason for hiding this comment

The 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
Expand All @@ -24,7 +52,7 @@ def save_screenshot [ method, theme_name ] {
"powershell" => {
let ps_script = $"
use .. *
source ($name)
source ../nu-themes/($theme_name).nu
Copy link
Contributor

@fdncred fdncred Feb 5, 2026

Choose a reason for hiding this comment

The 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 const p = path self at the top of the file to figure where we're at first.

clear
sleep 100ms
print `Theme name: '($theme_name)'`
Expand All @@ -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)
Expand All @@ -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)'`
Expand Down Expand Up @@ -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/"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down
9 changes: 6 additions & 3 deletions toolkit.nu
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def "with files" [
}
}

def "lint check" []: path -> int {
export def "lint check" [--only-errors]: path -> int {
let file = $in
let test_methodology = $env.TEST_METHOD? | default "import-or-source"

Expand Down Expand Up @@ -113,7 +113,9 @@ def "lint check" []: path -> int {
}
let error_count = $diagnostics | length
if $error_count == 0 {
print $"lint: ✔ ($file) is ok"
if not $only_errors {
print $"lint: ✔ ($file) is ok"
}
} else {
print $"lint: ❌ ($file) has errors:\n($diagnostics | table)"
}
Expand All @@ -127,8 +129,9 @@ def "lint check" []: path -> int {
export def lint [
--full # Check all files instead of input
--and-exit # Exit with error count
--only-errors # Only print files with errors
]: [list<path> -> int, nothing -> int] {
with files --full=$full --and-exit=$and_exit {
par-each { lint check }
par-each { lint check --only-errors=$only_errors }
}
}