1
Fork 0
mirror of https://github.com/RGBCube/nu_scripts synced 2025-08-02 07:07:46 +00:00

use $nu.os-info vs (sys).host for speed (#212)

This commit is contained in:
Darren Schroeder 2022-04-25 06:29:49 -05:00 committed by GitHub
parent 47edd7dbbc
commit 8e23fe5560
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -168,13 +168,13 @@ def get_icon_by_name [name] {
def get_os_icon [os] { def get_os_icon [os] {
# f17c = tux, f179 = apple, f17a = windows # f17c = tux, f179 = apple, f17a = windows
if ($os.name =~ Darwin) { if ($os.name =~ macos) {
(char -u f179) (char -u f179)
} else if ($os.name =~ Linux) { } else if ($os.name =~ windows) {
(char -u f17c)
} else if ($os.name =~ Windows) {
(char -u f17a) (char -u f17a)
} else if ($os.'kernel version' =~ WSL) { } else if ($os.family =~ unix) {
(char -u f17c)
} else if ($os.kernel_version =~ WSL) {
$'(char -u f17a)(char -u f17c)' $'(char -u f17a)(char -u f17c)'
} else { } else {
'' ''
@ -505,7 +505,7 @@ def git_right_prompt [gs os] {
export def git_prompt [] { export def git_prompt [] {
let gs = (gstat) let gs = (gstat)
let os = ((sys).host) let os = $nu.os-info
let left_prompt = (git_left_prompt $gs $os) let left_prompt = (git_left_prompt $gs $os)
let right_prompt = (git_right_prompt $gs $os) let right_prompt = (git_right_prompt $gs $os)