From f2bfa20a0c09e9595d585ba58816f5529bd03749 Mon Sep 17 00:00:00 2001 From: michaeljguarino Date: Mon, 19 Jun 2023 03:19:54 -0400 Subject: [PATCH] Infer name in `plural link` (#419) The basename of the path is actually always the same as the module name, so we can actually infer this. --- cmd/plural/link.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cmd/plural/link.go b/cmd/plural/link.go index 24e85afa..63d59fe9 100644 --- a/cmd/plural/link.go +++ b/cmd/plural/link.go @@ -1,6 +1,8 @@ package plural import ( + "path/filepath" + "github.com/pluralsh/plural/pkg/manifest" "github.com/urfave/cli" ) @@ -36,6 +38,10 @@ func handleLink(c *cli.Context) error { tool, repo := c.Args().Get(0), c.Args().Get(1) name, path := c.String("name"), c.String("path") + if name == "" { + name = filepath.Base(path) + } + manPath, err := manifest.ManifestPath(repo) if err != nil { return err