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

Replace deprecated operators in panache-git (#321)

Use `and` in favor of `&&`
Use `or` in favor of `||`

https://www.nushell.sh/blog/2022-11-29-nushell-0.72.html#new-boolean-operator-xor-planned-operator-simplification
This commit is contained in:
Edward DeVries 2022-12-03 21:54:33 -05:00 committed by GitHub
parent 3451c3f0e0
commit fe5c307390
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -131,7 +131,7 @@ export def repo-structured [] {
let has_staging_or_worktree_changes = (if $in_git_repo { let has_staging_or_worktree_changes = (if $in_git_repo {
$status $status
| where ($it | str starts-with '1') || ($it | str starts-with '2') | where ($it | str starts-with '1') or ($it | str starts-with '2')
| str join | str join
| is-empty | is-empty
| nope | nope
@ -161,7 +161,7 @@ export def repo-structured [] {
let staging_worktree_table = (if $has_staging_or_worktree_changes { let staging_worktree_table = (if $has_staging_or_worktree_changes {
$status $status
| where ($it | str starts-with '1') || ($it | str starts-with '2') | where ($it | str starts-with '1') or ($it | str starts-with '2')
| split column ' ' | split column ' '
| get column2 | get column2
| split column '' staging worktree --collapse-empty | split column '' staging worktree --collapse-empty
@ -251,31 +251,31 @@ export def repo-styled [] {
let is_local_only = ($status.tracking_upstream_branch != true) let is_local_only = ($status.tracking_upstream_branch != true)
let upstream_deleted = ( let upstream_deleted = (
$status.tracking_upstream_branch && $status.tracking_upstream_branch and
$status.upstream_exists_on_remote != true $status.upstream_exists_on_remote != true
) )
let is_up_to_date = ( let is_up_to_date = (
$status.upstream_exists_on_remote && $status.upstream_exists_on_remote and
$status.commits_ahead == 0 && $status.commits_ahead == 0 and
$status.commits_behind == 0 $status.commits_behind == 0
) )
let is_ahead = ( let is_ahead = (
$status.upstream_exists_on_remote && $status.upstream_exists_on_remote and
$status.commits_ahead > 0 && $status.commits_ahead > 0 and
$status.commits_behind == 0 $status.commits_behind == 0
) )
let is_behind = ( let is_behind = (
$status.upstream_exists_on_remote && $status.upstream_exists_on_remote and
$status.commits_ahead == 0 && $status.commits_ahead == 0 and
$status.commits_behind > 0 $status.commits_behind > 0
) )
let is_ahead_and_behind = ( let is_ahead_and_behind = (
$status.upstream_exists_on_remote && $status.upstream_exists_on_remote and
$status.commits_ahead > 0 && $status.commits_ahead > 0 and
$status.commits_behind > 0 $status.commits_behind > 0
) )
@ -310,15 +310,15 @@ export def repo-styled [] {
}) })
let has_staging_changes = ( let has_staging_changes = (
$status.staging_added_count > 0 || $status.staging_added_count > 0 or
$status.staging_modified_count > 0 || $status.staging_modified_count > 0 or
$status.staging_deleted_count > 0 $status.staging_deleted_count > 0
) )
let has_worktree_changes = ( let has_worktree_changes = (
$status.untracked_count > 0 || $status.untracked_count > 0 or
$status.worktree_modified_count > 0 || $status.worktree_modified_count > 0 or
$status.worktree_deleted_count > 0 || $status.worktree_deleted_count > 0 or
$status.merge_conflict_count > 0 $status.merge_conflict_count > 0
) )
@ -342,7 +342,7 @@ export def repo-styled [] {
'' ''
}) })
let delimiter = (if ($has_staging_changes && $has_worktree_changes) { let delimiter = (if ($has_staging_changes and $has_worktree_changes) {
('|' | bright-yellow) ('|' | bright-yellow)
} else { } else {
'' ''