MCPcopy Create free account
hub / github.com/celer-pkg/celer / Command

Method Command

cmds/cmd_integrate.go:26–53  ·  view source on GitHub ↗
(celer *configs.Celer)

Source from the content-addressed store, hash-verified

24var currentShellFn = completion.CurrentShell
25
26func (i *integrateCmd) Command(celer *configs.Celer) *cobra.Command {
27 command := &cobra.Command{
28 Use: "integrate",
29 Short: "Integrate shell tab completion.",
30 Long: `Integrate shell tab completion for celer commands.
31
32This command will install or remove shell completion scripts.
33On Linux, celer integrates completion for your current shell (bash or zsh).
34On Windows, celer integrates PowerShell completion.
35
36Examples:
37 celer integrate # Install tab completion
38 celer integrate --remove # Remove tab completion`,
39 Args: cobra.NoArgs,
40 RunE: func(cobraCmd *cobra.Command, args []string) error {
41 return i.execute()
42 },
43 ValidArgsFunction: i.completion,
44 }
45
46 // Register flags.
47 command.Flags().BoolVar(&i.remove, "remove", false, "remove shell tab completion")
48
49 // Silence cobra's error and usage output to avoid duplicate messages.
50 command.SilenceErrors = true
51 command.SilenceUsage = true
52 return command
53}
54
55// execute performs the main logic for integration.
56func (i *integrateCmd) execute() error {

Callers 3

runIntegrateFunction · 0.95

Calls 1

executeMethod · 0.95

Tested by 3

runIntegrateFunction · 0.76