Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

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())
})