From 50538936fc17e5c52a80369b7af45109534a54ee Mon Sep 17 00:00:00 2001 From: Dan Davison Date: Wed, 7 Sep 2022 07:24:10 -0400 Subject: [PATCH] Respond to upstream changes: empty? -> is-empty (#290) --- prompt/async_git_prompt/README.md | 5 +++++ prompt/async_git_prompt/async-git-prompt.nu | 4 ++-- prompt/async_git_prompt/prompt.nu | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/prompt/async_git_prompt/README.md b/prompt/async_git_prompt/README.md index 11f707b..c423374 100644 --- a/prompt/async_git_prompt/README.md +++ b/prompt/async_git_prompt/README.md @@ -26,3 +26,8 @@ To use this module: ``` 5. To go back to synchronous mode, run `async-git-prompt-delete-cache`. + +### TODO + +- Automatic cache invalidation +- Show untracked files (this can be very expensive in large repos) diff --git a/prompt/async_git_prompt/async-git-prompt.nu b/prompt/async_git_prompt/async-git-prompt.nu index 1447c3e..c713bc8 100644 --- a/prompt/async_git_prompt/async-git-prompt.nu +++ b/prompt/async_git_prompt/async-git-prompt.nu @@ -16,7 +16,7 @@ def do-async [commands: string] { export def async-git-prompt-string [] { let cache_path = (cache-path) - if ($cache_path | empty?) { + if ($cache_path | is-empty) { "" } else if ($cache_path | path exists) { $"(cached-result-symbol)(open $cache_path | str trim)" @@ -69,7 +69,7 @@ def cache-path [] { } else { do -i { git rev-parse --show-toplevel | str trim -r } } - if ($dir | empty?) { + if ($dir | is-empty) { null } else { $dir | path join (cache-file) diff --git a/prompt/async_git_prompt/prompt.nu b/prompt/async_git_prompt/prompt.nu index a8b3eda..3b74332 100644 --- a/prompt/async_git_prompt/prompt.nu +++ b/prompt/async_git_prompt/prompt.nu @@ -3,7 +3,7 @@ use async-git-prompt.nu * def prompt-concat [parts: table] { $parts - | where (not ($it.text | empty?)) + | where (not ($it.text | is-empty)) | each { |it| $"($it.color)($it.text)" } | str collect ' ' }