From 6e026f173dd6de04ed998d8d2d3388d4fb796f65 Mon Sep 17 00:00:00 2001 From: comp500 Date: Tue, 24 Sep 2024 20:31:38 +0100 Subject: [PATCH] rehash command tweaks --- cmd/rehash.go | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/cmd/rehash.go b/cmd/rehash.go index 0019d70..4f9ad39 100644 --- a/cmd/rehash.go +++ b/cmd/rehash.go @@ -4,6 +4,8 @@ import ( "fmt" "os" + "github.com/packwiz/packwiz/cmdshared" + "github.com/packwiz/packwiz/core" "github.com/spf13/cobra" "golang.org/x/exp/slices" @@ -11,8 +13,8 @@ import ( // rehashCmd represents the rehash command var rehashCmd = &cobra.Command{ - Use: "rehash", - Short: "Migrate all hashes to a specific function", + Use: "rehash [hash format]", + Short: "Migrate all hashes to a specific format", Args: cobra.ExactArgs(1), Run: func(cmd *cobra.Command, args []string) { @@ -47,6 +49,9 @@ var rehashCmd = &cobra.Command{ fmt.Printf("Error retrieving external files: %v\n", err) os.Exit(1) } + + cmdshared.ListManualDownloads(session) + for dl := range session.StartDownloads() { if dl.Error != nil { fmt.Printf("Error retrieving %s: %v\n", dl.Mod.Name, dl.Error) @@ -62,6 +67,12 @@ var rehashCmd = &cobra.Command{ // TODO pass the hash to index instead of recomputing from scratch } + err = session.SaveIndex() + if err != nil { + fmt.Printf("Error saving cache index: %v\n", err) + os.Exit(1) + } + err = index.Refresh() if err != nil { fmt.Printf("Error refreshing index: %v\n", err)