Skip to content

Commit

Permalink
define custom log commands for better output
Browse files Browse the repository at this point in the history
let's add some colors to this 😋
  • Loading branch information
amtoine committed Jul 20, 2024
1 parent 5a73ddf commit 904ace1
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions themes/src/make.nu
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,18 @@ let CUSTOM_SOURCE = {

let themes_dir = ($current_dir | path join "../nu-themes")

def info [msg: string, --no-newline (-n)] {
print --no-newline=$no_newline $"(ansi green)[INFO](ansi reset) ($msg)"
}

def err [msg: string, --no-newline (-n)] {
print --no-newline=$no_newline $"(ansi red_bold)[ERR](ansi reset) ($msg)"
}

def warn [msg: string, --no-newline (-n)] {
print --no-newline=$no_newline $"(ansi yellow)[WARNING](ansi reset) ($msg)"
}

# For lemnos themes, create the color_config from the lemnos theme
# definition.
# Custom Nushell themes should be defined in themes/src/custom-nu-themes
Expand Down Expand Up @@ -212,12 +224,11 @@ def main [] {
| path parse
| get stem
| each {|theme|
print $"Converting ($theme)"
info -n $"Converting ($theme) \r"
try {
make_theme $theme
} catch {|e|
print -e $"Error converting ($theme)"
print -e $e.debug
err $"Converting ($theme) failed: ($e.msg)"
}
}
| ignore
Expand All @@ -227,12 +238,11 @@ def main [] {
| path parse
| get stem
| each {|theme|
print $"Converting ($theme)"
info -n $"Converting ($theme) \r"
try {
make_theme $theme "custom"
} catch {|e|
print -e $"Error converting ($theme)"
print -e $e.debug
err $"Converting ($theme) failed: ($e.msg)"
}
}

Expand Down

0 comments on commit 904ace1

Please sign in to comment.