mirror of
https://github.com/packwiz/packwiz.git
synced 2025-04-19 21:16:30 +02:00
rehash command tweaks
This commit is contained in:
parent
0bb89a4872
commit
6e026f173d
@ -4,6 +4,8 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
|
"github.com/packwiz/packwiz/cmdshared"
|
||||||
|
|
||||||
"github.com/packwiz/packwiz/core"
|
"github.com/packwiz/packwiz/core"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"golang.org/x/exp/slices"
|
"golang.org/x/exp/slices"
|
||||||
@ -11,8 +13,8 @@ import (
|
|||||||
|
|
||||||
// rehashCmd represents the rehash command
|
// rehashCmd represents the rehash command
|
||||||
var rehashCmd = &cobra.Command{
|
var rehashCmd = &cobra.Command{
|
||||||
Use: "rehash",
|
Use: "rehash [hash format]",
|
||||||
Short: "Migrate all hashes to a specific function",
|
Short: "Migrate all hashes to a specific format",
|
||||||
Args: cobra.ExactArgs(1),
|
Args: cobra.ExactArgs(1),
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
|
|
||||||
@ -47,6 +49,9 @@ var rehashCmd = &cobra.Command{
|
|||||||
fmt.Printf("Error retrieving external files: %v\n", err)
|
fmt.Printf("Error retrieving external files: %v\n", err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cmdshared.ListManualDownloads(session)
|
||||||
|
|
||||||
for dl := range session.StartDownloads() {
|
for dl := range session.StartDownloads() {
|
||||||
if dl.Error != nil {
|
if dl.Error != nil {
|
||||||
fmt.Printf("Error retrieving %s: %v\n", dl.Mod.Name, dl.Error)
|
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
|
// 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()
|
err = index.Refresh()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Printf("Error refreshing index: %v\n", err)
|
fmt.Printf("Error refreshing index: %v\n", err)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user