PreInvoke
PreInvoke
is called after arguments are parsed and allows generic modification of an Action before it is invoked.
carapace.Gen(rootCmd).PreInvoke(func(cmd *cobra.Command, flag *pflag.Flag, action carapace.Action) carapace.Action {
return action.Chdir(rootCmd.Flag("chdir").Value.String())
})