Add no-internal-hashes mode

This commit is contained in:
comp500
2021-05-04 19:56:56 +01:00
parent 3462dd7f21
commit 49d7b26b2e
6 changed files with 51 additions and 26 deletions

View File

@@ -157,7 +157,7 @@ var initCmd = &cobra.Command{
Index: struct {
File string `toml:"file"`
HashFormat string `toml:"hash-format"`
Hash string `toml:"hash"`
Hash string `toml:"hash,omitempty"`
}{
File: indexFilePath,
},

View File

@@ -2,6 +2,7 @@ package cmd
import (
"fmt"
"github.com/spf13/viper"
"os"
"github.com/comp500/packwiz/core"
@@ -20,6 +21,12 @@ var refreshCmd = &cobra.Command{
fmt.Println(err)
os.Exit(1)
}
build, err := cmd.Flags().GetBool("build")
if err == nil && build {
viper.Set("no-internal-hashes", false)
} else if viper.GetBool("no-internal-hashes") {
fmt.Println("Note: no-internal-hashes mode is set, no hashes will be saved. Use --build to override this for distribution.")
}
index, err := pack.LoadIndex()
if err != nil {
fmt.Println(err)
@@ -51,4 +58,6 @@ var refreshCmd = &cobra.Command{
func init() {
rootCmd.AddCommand(refreshCmd)
refreshCmd.Flags().Bool("build", false, "Only has an effect in no-internal-hashes mode: generates internal hashes for distribution with packwiz-installer")
}