mirror of
https://github.com/ddworken/hishtory.git
synced 2025-08-18 18:58:54 +02:00
Use separate flag for skipping update config mods to enable future flexibility
This commit is contained in:
@@ -30,6 +30,7 @@ var (
|
||||
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")
|
||||
}
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user