Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 7 additions & 15 deletions cmd/hook.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
package cmd

import (
"context"
"fmt"

"github.com/spf13/cobra"
"github.com/windsorcli/cli/pkg/di"
"github.com/windsorcli/cli/pkg/pipelines"
"github.com/windsorcli/cli/pkg/runtime"
)

var hookCmd = &cobra.Command{
Expand All @@ -19,21 +18,14 @@ var hookCmd = &cobra.Command{
// Get shared dependency injector from context
injector := cmd.Context().Value(injectorKey).(di.Injector)

// Create execution context with shell type
ctx := context.WithValue(cmd.Context(), "shellType", args[0])
if verbose {
ctx = context.WithValue(ctx, "verbose", true)
}
// Create Runtime and execute hook installation
err := runtime.NewRuntime(injector).
LoadShell().
InstallHook(args[0]).
Do()

// Set up the hook pipeline
pipeline, err := pipelines.WithPipeline(injector, ctx, "hookPipeline")
if err != nil {
return fmt.Errorf("failed to set up hook pipeline: %w", err)
}

// Execute the pipeline
if err := pipeline.Execute(ctx); err != nil {
return fmt.Errorf("Error executing hook pipeline: %w", err)
return fmt.Errorf("Error installing hook: %w", err)
}

return nil
Expand Down
57 changes: 0 additions & 57 deletions pkg/pipelines/hook.go

This file was deleted.

146 changes: 0 additions & 146 deletions pkg/pipelines/hook_test.go

This file was deleted.

1 change: 0 additions & 1 deletion pkg/pipelines/pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ var pipelineConstructors = map[string]PipelineConstructor{
"initPipeline": func() Pipeline { return NewInitPipeline() },
"execPipeline": func() Pipeline { return NewExecPipeline() },
"contextPipeline": func() Pipeline { return NewContextPipeline() },
"hookPipeline": func() Pipeline { return NewHookPipeline() },
"checkPipeline": func() Pipeline { return NewCheckPipeline() },
"upPipeline": func() Pipeline { return NewUpPipeline() },
"downPipeline": func() Pipeline { return NewDownPipeline() },
Expand Down
2 changes: 0 additions & 2 deletions pkg/pipelines/pipeline_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,6 @@ func TestWithPipeline(t *testing.T) {
{"InitPipeline", "initPipeline"},
{"ExecPipeline", "execPipeline"},
{"ContextPipeline", "contextPipeline"},
{"HookPipeline", "hookPipeline"},
{"CheckPipeline", "checkPipeline"},
{"UpPipeline", "upPipeline"},
{"DownPipeline", "downPipeline"},
Expand Down Expand Up @@ -728,7 +727,6 @@ func TestWithPipeline(t *testing.T) {
"initPipeline",
"execPipeline",
"contextPipeline",
"hookPipeline",
"checkPipeline",
"basePipeline",
}
Expand Down
Loading
Loading