fix: replace deprecated str downcase/upcase with str lowercase/uppercase
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
def _pj_detect_os_key [] {
|
def _pj_detect_os_key [] {
|
||||||
let host_name = (((sys host | get name?) | default ($nu.os-info.name? | default "")) | into string | str downcase)
|
let host_name = (((sys host | get name?) | default ($nu.os-info.name? | default "")) | into string | str lowercase)
|
||||||
if ($host_name | str contains "darwin") {
|
if ($host_name | str contains "darwin") {
|
||||||
return "Macos"
|
return "Macos"
|
||||||
}
|
}
|
||||||
@@ -18,7 +18,7 @@ def _pj_detect_os_key [] {
|
|||||||
if ($os_release != "") {
|
if ($os_release != "") {
|
||||||
let id_line = (open $os_release | lines | where {|l| $l | str starts-with "ID=" } | get 0?)
|
let id_line = (open $os_release | lines | where {|l| $l | str starts-with "ID=" } | get 0?)
|
||||||
let id = if ($id_line == null) { "" } else { (($id_line | str replace "ID=" "") | str trim -c '"') }
|
let id = if ($id_line == null) { "" } else { (($id_line | str replace "ID=" "") | str trim -c '"') }
|
||||||
match ($id | str downcase) {
|
match ($id | str lowercase) {
|
||||||
"alpine" => "Alpine"
|
"alpine" => "Alpine"
|
||||||
"alma" => "AlmaLinux"
|
"alma" => "AlmaLinux"
|
||||||
"almalinux" => "AlmaLinux"
|
"almalinux" => "AlmaLinux"
|
||||||
@@ -506,7 +506,7 @@ def _pj_git_branch_module [p: record, git: record] {
|
|||||||
# # lowercase extensions is checked per-language below. glob is
|
# # lowercase extensions is checked per-language below. glob is
|
||||||
# # case-insensitive on Windows, so *.CPP is matched by "cpp" too.
|
# # case-insensitive on Windows, so *.CPP is matched by "cpp" too.
|
||||||
# let exts = (glob *.{c,h,cpp,cc,cxx,hpp,hh,hxx,rs,zig,py}
|
# let exts = (glob *.{c,h,cpp,cc,cxx,hpp,hh,hxx,rs,zig,py}
|
||||||
# | each {|f| $f | path parse | get extension | str downcase }
|
# | each {|f| $f | path parse | get extension | str lowercase }
|
||||||
# | uniq)
|
# | uniq)
|
||||||
#
|
#
|
||||||
# let has_c = ("c" in $exts or "h" in $exts)
|
# let has_c = ("c" in $exts or "h" in $exts)
|
||||||
@@ -585,7 +585,7 @@ def _pj_prompt_static_base [] {
|
|||||||
|
|
||||||
let host = (sys host | get hostname? | default "")
|
let host = (sys host | get hostname? | default "")
|
||||||
let in_ssh = (($env.SSH_CONNECTION? | default "") != "" or ($env.SSH_TTY? | default "") != "")
|
let in_ssh = (($env.SSH_CONNECTION? | default "") != "" or ($env.SSH_TTY? | default "") != "")
|
||||||
# let prompt_newline = if (($nu.os-info.name | str downcase) == "windows") { "\n\r" } else { "\n\r" }
|
# let prompt_newline = if (($nu.os-info.name | str lowercase) == "windows") { "\n\r" } else { "\n\r" }
|
||||||
let prompt_newline = "\n\r"
|
let prompt_newline = "\n\r"
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
export def --env "pj uvthu" [] {
|
export def --env "pj uvthu" [] {
|
||||||
let os_name = ($nu.os-info.name? | default "" | into string | str downcase)
|
let os_name = ($nu.os-info.name? | default "" | into string | str lowercase)
|
||||||
if not (($os_name | str contains "darwin") or ($os_name | str contains "macos")) {
|
if not (($os_name | str contains "darwin") or ($os_name | str contains "macos")) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ export-env {
|
|||||||
#
|
#
|
||||||
|
|
||||||
def _pj_normalize_windows_drive [path: string] {
|
def _pj_normalize_windows_drive [path: string] {
|
||||||
if (($nu.os-info.name | str downcase) != "windows") {
|
if (($nu.os-info.name | str lowercase) != "windows") {
|
||||||
return $path
|
return $path
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,7 +52,7 @@ def _pj_normalize_windows_drive [path: string] {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let item = ($parsed | first)
|
let item = ($parsed | first)
|
||||||
$"(($item.drive | str upcase)):($item.rest)"
|
$"(($item.drive | str uppercase)):($item.rest)"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Jump to a directory using only keywords.
|
# Jump to a directory using only keywords.
|
||||||
|
|||||||
Reference in New Issue
Block a user