forked from Plemya-x/ALR
wip
This commit is contained in:
6
repo.go
6
repo.go
@ -20,7 +20,6 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"log/slog"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
@ -76,7 +75,7 @@ func AddRepoCmd() *cli.Command {
|
||||
|
||||
reposSlice := cfg.Repos()
|
||||
for _, repo := range reposSlice {
|
||||
if repo.URL == repoURL {
|
||||
if repo.URL == repoURL || repo.Name == name {
|
||||
return cliutils.FormatCliExit(gotext.Get("Repo %s already exists", repo.Name), nil)
|
||||
}
|
||||
}
|
||||
@ -154,8 +153,7 @@ func RemoveRepoCmd() *cli.Command {
|
||||
}
|
||||
}
|
||||
if !found {
|
||||
slog.Error(gotext.Get("Repo does not exist"), "name", name)
|
||||
os.Exit(1)
|
||||
return cliutils.FormatCliExit(gotext.Get("Repo \"%s\" does not exist", name), nil)
|
||||
}
|
||||
|
||||
cfg.SetRepos(slices.Delete(reposSlice, index, index+1))
|
||||
|
Reference in New Issue
Block a user