This repository has been archived by the owner on Nov 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from NotLebedev/nu-87
Update to nushell 0.87.1
- Loading branch information
Showing
6 changed files
with
42 additions
and
37 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,32 @@ | ||
# Logging | ||
|
||
def color [color: string, msg: string] { $"(ansi $color)($msg)(ansi reset)" } | ||
export def color [color: string, msg: string] { $"(ansi $color)($msg)(ansi reset)" } | ||
|
||
def blue [msg: string] { color "blue" $msg } | ||
def green [msg: string] { color "green" $msg } | ||
def red [msg: string] { color "red" $msg } | ||
def purple [msg: string] { color "purple" $msg } | ||
def yellow [msg: string] { color "yellow" $msg } | ||
export def blue [msg: string] { color "blue" $msg } | ||
export def green [msg: string] { color "green" $msg } | ||
export def red [msg: string] { color "red" $msg } | ||
export def purple [msg: string] { color "purple" $msg } | ||
export def yellow [msg: string] { color "yellow" $msg } | ||
|
||
def banner [text: string] { print $"(red ">>>") (green $text)" } | ||
def info [msg: string] { print $"(blue ">") ($msg)" } | ||
def error [msg: string] { print $"(red "ERROR") ($msg)" } | ||
def item [msg: string] { print $"(purple "+") ($msg)"} | ||
export def banner [text: string] { print $"(red ">>>") (green $text)" } | ||
export def info [msg: string] { print $"(blue ">") ($msg)" } | ||
export def error [msg: string] { print $"(red "ERROR") ($msg)" } | ||
export def item [msg: string] { print $"(purple "+") ($msg)"} | ||
|
||
# Misc helpers | ||
|
||
## Add an "s" to the end of a word if n is greater than 1 | ||
def plural [n: int] { if $n > 1 { "s" } else { "" } } | ||
export def plural [n: int] { if $n > 1 { "s" } else { "" } } | ||
|
||
## Convert a Nix Boolean into a Nushell Boolean ("1" = true, "0" = false) | ||
def envToBool [var: string] { | ||
export def envToBool [var: string] { | ||
($var | into int) == 1 | ||
} | ||
|
||
## Get package root | ||
def getPkgRoot [path: path] { $path | parse "{root}/bin/{__bin}" | get root.0 } | ||
export def getPkgRoot [path: path] { $path | parse "{root}/bin/{__bin}" | get root.0 } | ||
|
||
## Get package name fro full store path | ||
def getPkgName [storeRoot: path, path: path] { | ||
export def getPkgName [storeRoot: path, path: path] { | ||
$path | parse $"($storeRoot)/{__hash}-{pkg}" | select pkg | get pkg.0 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters