fix: replace deprecated str downcase/upcase with str lowercase/uppercase

This commit is contained in:
2026-07-20 15:33:05 +08:00
parent cc1aab33a3
commit 427fa547a6
3 changed files with 7 additions and 7 deletions
+4 -4
View File
@@ -1,5 +1,5 @@
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") {
return "Macos"
}
@@ -18,7 +18,7 @@ def _pj_detect_os_key [] {
if ($os_release != "") {
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 '"') }
match ($id | str downcase) {
match ($id | str lowercase) {
"alpine" => "Alpine"
"alma" => "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
# # 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}
# | each {|f| $f | path parse | get extension | str downcase }
# | each {|f| $f | path parse | get extension | str lowercase }
# | uniq)
#
# 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 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"
{