Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix $.span in error make #61

Merged
merged 2 commits into from
Nov 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions src/nu-git-manager-sugar/gist.nu
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
}
Expand Down
8 changes: 2 additions & 6 deletions src/nu-git-manager-sugar/git.nu
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
}
Expand Down Expand Up @@ -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)
}
}
}
Expand Down
3 changes: 1 addition & 2 deletions src/nu-git-manager/error/error.nu
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}