mirror of
https://github.com/RGBCube/nu_scripts
synced 2025-08-02 07:07:46 +00:00
Respond to upstream changes: empty? -> is-empty (#290)
This commit is contained in:
parent
97b9c1202a
commit
50538936fc
3 changed files with 8 additions and 3 deletions
|
@ -26,3 +26,8 @@ To use this module:
|
||||||
```
|
```
|
||||||
|
|
||||||
5. To go back to synchronous mode, run `async-git-prompt-delete-cache`.
|
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)
|
||||||
|
|
|
@ -16,7 +16,7 @@ def do-async [commands: string] {
|
||||||
|
|
||||||
export def async-git-prompt-string [] {
|
export def async-git-prompt-string [] {
|
||||||
let cache_path = (cache-path)
|
let cache_path = (cache-path)
|
||||||
if ($cache_path | empty?) {
|
if ($cache_path | is-empty) {
|
||||||
""
|
""
|
||||||
} else if ($cache_path | path exists) {
|
} else if ($cache_path | path exists) {
|
||||||
$"(cached-result-symbol)(open $cache_path | str trim)"
|
$"(cached-result-symbol)(open $cache_path | str trim)"
|
||||||
|
@ -69,7 +69,7 @@ def cache-path [] {
|
||||||
} else {
|
} else {
|
||||||
do -i { git rev-parse --show-toplevel | str trim -r }
|
do -i { git rev-parse --show-toplevel | str trim -r }
|
||||||
}
|
}
|
||||||
if ($dir | empty?) {
|
if ($dir | is-empty) {
|
||||||
null
|
null
|
||||||
} else {
|
} else {
|
||||||
$dir | path join (cache-file)
|
$dir | path join (cache-file)
|
||||||
|
|
|
@ -3,7 +3,7 @@ use async-git-prompt.nu *
|
||||||
|
|
||||||
def prompt-concat [parts: table] {
|
def prompt-concat [parts: table] {
|
||||||
$parts
|
$parts
|
||||||
| where (not ($it.text | empty?))
|
| where (not ($it.text | is-empty))
|
||||||
| each { |it| $"($it.color)($it.text)" }
|
| each { |it| $"($it.color)($it.text)" }
|
||||||
| str collect ' '
|
| str collect ' '
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue