From a4433fcca131a841a133e5f915d4c9913f2b5436 Mon Sep 17 00:00:00 2001 From: amtoine Date: Sat, 4 Nov 2023 16:44:40 +0100 Subject: [PATCH 1/2] fix the span in `throw-error` --- src/nu-git-manager/error/error.nu | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/nu-git-manager/error/error.nu b/src/nu-git-manager/error/error.nu index 5420f6c1..c321cf9b 100644 --- a/src/nu-git-manager/error/error.nu +++ b/src/nu-git-manager/error/error.nu @@ -6,8 +6,7 @@ export def throw-error [ msg: $"(ansi red_bold)($error.msg)(ansi reset)" label: { text: $error.label.text - start: $error.label.span.start - end: $error.label.span.end + span: $error.label.span } } } From 3db10101ed3f917f429e7ea7cef030d44c1b48fa Mon Sep 17 00:00:00 2001 From: amtoine Date: Sat, 4 Nov 2023 16:46:20 +0100 Subject: [PATCH 2/2] fix the spans in *sugar* --- src/nu-git-manager-sugar/gist.nu | 4 +--- src/nu-git-manager-sugar/git.nu | 8 ++------ 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/src/nu-git-manager-sugar/gist.nu b/src/nu-git-manager-sugar/gist.nu index 2549407a..f0d6f103 100644 --- a/src/nu-git-manager-sugar/gist.nu +++ b/src/nu-git-manager-sugar/gist.nu @@ -65,13 +65,11 @@ export def list [ )} if ($user | is-empty) { - let span = (metadata $user | get span) error make { msg: $"(ansi red)gist::no_user_given(ansi reset)" label: { text: "no user given" - start: $span.start - end: $span.end + span: (metadata $user | get span) } } } diff --git a/src/nu-git-manager-sugar/git.nu b/src/nu-git-manager-sugar/git.nu index 2ef8b78b..10a2bb76 100644 --- a/src/nu-git-manager-sugar/git.nu +++ b/src/nu-git-manager-sugar/git.nu @@ -127,13 +127,11 @@ export def "remote add" [ --ssh # use SSH as the communication protocol ] { if $name in (remote list | get remote) { - let span = (metadata $name | get span) error make { msg: $"(ansi red_bold)remote_already_in_index(ansi reset)" label: { text: $"already a remote of ($env.PWD)" - start: $span.start - end: $span.end + span: (metadata $name | get span) } } } @@ -186,13 +184,11 @@ export def fixup [ revision: string # the revision of the Git worktree to fixup ] { if (do --ignore-errors { git rev-parse $revision } | complete | get exit_code) != 0 { - let span = (metadata $revision | get span) error make { msg: $"(ansi red_bold)revision_not_found(ansi reset)" label: { text: $"($revision) not found in the working tree of ($env.PWD)" - start: $span.start - end: $span.end + span: (metadata $revision | get span) } } }