Skip to content

Commit

Permalink
new line
Browse files Browse the repository at this point in the history
  • Loading branch information
hariso committed Jan 17, 2025
1 parent 4d752d3 commit 8fc4c5f
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions cmd/conduit/root/pipelines/describe.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,12 @@ var (
_ ecdysis.CommandWithArgs = (*DescribeCommand)(nil)
)

type DescribeCommand struct {
type DescribeArgs struct {
PipelineID string
}
type DescribeCommand struct {
args DescribeArgs
}

func (c *DescribeCommand) Docs() ecdysis.Docs {
return ecdysis.Docs{
Expand All @@ -60,36 +63,36 @@ func (c *DescribeCommand) Args(args []string) error {
return cerrors.Errorf("too many arguments")
}

c.PipelineID = args[0]
c.args.PipelineID = args[0]
return nil
}

func (c *DescribeCommand) ExecuteWithClient(ctx context.Context, client *api.Client) error {
pipelineResp, err := client.PipelineServiceClient.GetPipeline(ctx, &apiv1.GetPipelineRequest{
Id: c.PipelineID,
Id: c.args.PipelineID,
})
if err != nil {
return fmt.Errorf("failed to get pipeline: %w", err)
}

// needed to show processors in connectors too
connectorsResp, err := client.ConnectorServiceClient.ListConnectors(ctx, &apiv1.ListConnectorsRequest{
PipelineId: c.PipelineID,
PipelineId: c.args.PipelineID,
})
if err != nil {
return fmt.Errorf("failed to list connectors for pipeline %s: %w", c.PipelineID, err)
return fmt.Errorf("failed to list connectors for pipeline %s: %w", c.args.PipelineID, err)
}

dlq, err := client.PipelineServiceClient.GetDLQ(ctx, &apiv1.GetDLQRequest{
Id: c.PipelineID,
Id: c.args.PipelineID,
})
if err != nil {
return fmt.Errorf("failed to fetch DLQ for pipeline %s: %w", c.PipelineID, err)
return fmt.Errorf("failed to fetch DLQ for pipeline %s: %w", c.args.PipelineID, err)
}

err = displayPipeline(ctx, pipelineResp.Pipeline, connectorsResp.Connectors, dlq.Dlq)
if err != nil {
return fmt.Errorf("failed to display pipeline %s: %w", c.PipelineID, err)
return fmt.Errorf("failed to display pipeline %s: %w", c.args.PipelineID, err)
}

return nil
Expand All @@ -114,7 +117,9 @@ func displayPipeline(ctx context.Context, pipeline *apiv1.Pipeline, connectors [
// Config
if pipeline.Config != nil {
fmt.Fprintf(&b, "Name: %s\n", pipeline.Config.Name)
fmt.Fprintf(&b, "Description: %s\n", pipeline.Config.Description)
// no new line after description, as it's always added
// when parsed from the YAML config file
fmt.Fprintf(&b, "Description: %s", pipeline.Config.Description)
}

// Connectors
Expand Down

0 comments on commit 8fc4c5f

Please sign in to comment.