feat: allow finding packages by "{repo}/{pkg}" and "{pkg}+alr-{repo}"

This commit is contained in:
2025-07-06 16:47:46 +03:00
parent 67a6cb31de
commit 4899e203bb
6 changed files with 124 additions and 53 deletions

View File

@ -23,7 +23,6 @@ import (
"log/slog"
"os"
"path/filepath"
"strings"
"github.com/leonelquinteros/gotext"
"github.com/urfave/cli/v2"
@ -133,15 +132,7 @@ func BuildCmd() *cli.Command {
// TODO: handle multiple packages
packageInput := c.String("package")
arr := strings.Split(packageInput, "/")
var packageSearch string
if len(arr) == 2 {
packageSearch = arr[1]
} else {
packageSearch = arr[0]
}
pkgs, _, err := deps.Repos.FindPkgs(ctx, []string{packageSearch})
pkgs, _, err := deps.Repos.FindPkgs(ctx, []string{packageInput})
if err != nil {
return cliutils.FormatCliExit("failed to find pkgs", err)
}