| 18 | } |
| 19 | |
| 20 | func Example(_ context.Context, logger *zap.Logger, _ *config.Config, _ ServiceFactory, _ CmdConfigurator) *cobra.Command { |
| 21 | var customSetup bool |
| 22 | var cmd = &cobra.Command{ |
| 23 | Use: "example", |
| 24 | Short: "Example to record and test via keploy", |
| 25 | RunE: func(cmd *cobra.Command, _ []string) error { |
| 26 | disableAnsi, _ := (cmd.Flags().GetBool("disable-ansi")) |
| 27 | provider.PrintLogo(os.Stdout, disableAnsi) |
| 28 | customSetup, err := cmd.Flags().GetBool("customSetup") |
| 29 | if err != nil { |
| 30 | utils.LogError(logger, nil, "failed to read the customSetup flag") |
| 31 | return err |
| 32 | } |
| 33 | if customSetup { |
| 34 | fmt.Println(provider.Examples) |
| 35 | return nil |
| 36 | } |
| 37 | fmt.Println(provider.ExampleOneClickInstall) |
| 38 | fmt.Println(provider.WithoutexampleOneClickInstall) |
| 39 | return nil |
| 40 | }, |
| 41 | } |
| 42 | cmd.SetHelpTemplate(provider.CustomHelpTemplate) |
| 43 | |
| 44 | cmd.Flags().Bool("customSetup", customSetup, "Check if the user is using one click install") |
| 45 | |
| 46 | return cmd |
| 47 | } |