mirror of
https://github.com/Squibid/rph.git
synced 2025-10-20 03:44:04 +00:00
feat(vendordep): add vendordep management
- Add vendordep add - Add vendordep remove - Add vendordep list - Refactor downloading
This commit is contained in:
41
cmd/vendordeplist.go
Normal file
41
cmd/vendordeplist.go
Normal file
@@ -0,0 +1,41 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log/slog"
|
||||
"rph/cmd/vendordep"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
// vendordeplistCmd represents the vendordep list command
|
||||
var vendordeplistCmd = &cobra.Command{
|
||||
Use: "list",
|
||||
Short: "List out your vendordeps",
|
||||
Long: `A longer description that spans multiple lines and likely contains examples
|
||||
and usage of using your command. For example:
|
||||
|
||||
Cobra is a CLI library for Go that empowers applications.
|
||||
This application is a tool to generate the needed files
|
||||
to quickly create a Cobra application.`,
|
||||
Aliases: []string{ "ls" },
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
if !inProjectDir() { return nil }
|
||||
|
||||
deps, err := vendordep.ListVendorDeps(projectFs)
|
||||
if err != nil {
|
||||
slog.Error("Unable to list vendor deps", "error", err)
|
||||
return err
|
||||
}
|
||||
|
||||
for _, dep := range deps {
|
||||
fmt.Println(dep.Name)
|
||||
}
|
||||
|
||||
return nil
|
||||
},
|
||||
}
|
||||
|
||||
func init() {
|
||||
vendordepCmd.AddCommand(vendordeplistCmd)
|
||||
}
|
Reference in New Issue
Block a user