Use separate flag for skipping update config mods to enable future flexibility

This commit is contained in:
David Dworken 2024-10-20 09:20:43 -07:00
parent e8e167ed00
commit 8bb87f2d7a
No known key found for this signature in database
2 changed files with 8 additions and 6 deletions

View File

@ -26,10 +26,11 @@ import (
)
var (
offlineInit *bool
forceInit *bool
offlineInstall *bool
skipConfigModification *bool
offlineInit *bool
forceInit *bool
offlineInstall *bool
skipConfigModification *bool
skipUpdateConfigModification *bool
)
var installCmd = &cobra.Command{
@ -45,7 +46,7 @@ var installCmd = &cobra.Command{
if strings.HasPrefix(secretKey, "-") {
lib.CheckFatalError(fmt.Errorf("secret key %#v looks like a CLI flag, please use a secret key that does not start with a -", secretKey))
}
lib.CheckFatalError(install(secretKey, *offlineInstall, *skipConfigModification))
lib.CheckFatalError(install(secretKey, *offlineInstall, *skipConfigModification || *skipUpdateConfigModification))
if os.Getenv("HISHTORY_SKIP_INIT_IMPORT") == "" {
db, err := hctx.OpenLocalSqliteDb()
lib.CheckFatalError(err)
@ -686,4 +687,5 @@ func init() {
forceInit = initCmd.Flags().Bool("force", false, "Force re-init without any prompts")
offlineInstall = installCmd.Flags().Bool("offline", false, "Install hiSHtory in offline mode with all syncing capabilities disabled")
skipConfigModification = installCmd.Flags().Bool("skip-config-modification", false, "Skip modifying shell configs and instead instruct the user on how to modify their configs")
skipUpdateConfigModification = installCmd.Flags().Bool("skip-update-config-modification", false, "Skip modifying shell configs for updates")
}

View File

@ -112,7 +112,7 @@ func update(ctx context.Context) error {
if err != nil {
return fmt.Errorf("failed to chmod +x the update (stdout=%#v, stderr=%#v): %w", stdout.String(), stderr.String(), err)
}
cmd = exec.Command(getTmpClientPath(), "install", "--skip-config-modification")
cmd = exec.Command(getTmpClientPath(), "install", "--skip-update-config-modification")
cmd.Stdout = os.Stdout
stderr = bytes.Buffer{}
cmd.Stdin = os.Stdin