Skip to content
Snippets Groups Projects
Select Git revision
  • rerouter
  • 197-message-re-router
  • 198-improve-process-complete-and-fatal-error-listeners-in-the-client
  • main default protected
  • 195-feat-tier-0-bundle-loader
  • transform
  • pauseSvcTask
  • headersTst
  • 191-generic-nats-kv-indexer
  • useer-tasks
  • addPauseResumeWfNotifications
  • intTestBackoff
  • 189-revisit-gatewayabort-subject-name-and-processing-2
  • gob2msgpack-vars-change
  • release protected
  • branch-3
  • 181-configure-shutdown-behaviour-on-nats-connection-problems
  • client-nats-api-fix
  • fix-minimum-backoff
  • splitExpressionTest
  • v1.1.1547
  • v1.1.1538
  • v1.1.1535
  • v1.1.1532
  • v1.1.1507
  • v1.1.1503
  • v1.1.1500
  • v1.1.1492
  • v1.1.1484
  • v1.1.1481
  • v1.1.1479
  • v1.1.1460
  • v1.1.1443
  • v1.1.1442
  • v1.1.1441
  • v1.1.1409
  • v1.1.1404
  • v1.1.1380
  • v1.1.1377
  • v1.1.1349
40 results

status.go

Code owners
Assign users and groups as approvers for specific file changes. Learn more.
status.go 779 B
package status

import (
	"context"
	"fmt"
	"github.com/spf13/cobra"
	"gitlab.com/shar-workflow/shar/cli/flag"
	"gitlab.com/shar-workflow/shar/cli/output"
	"gitlab.com/shar-workflow/shar/client"
)

var Cmd = &cobra.Command{
	Use:   "status",
	Short: "Gets the status of a running workflow instance",
	Long:  ``,
	RunE:  run,
	Args:  cobra.ExactValidArgs(1),
}

func run(_ *cobra.Command, args []string) error {
	ctx := context.Background()
	instanceID := args[0]
	shar := client.New(output.Logger)
	if err := shar.Dial(flag.Value.Server); err != nil {
		return fmt.Errorf("error dialling server: %w", err)
	}
	status, err := shar.GetWorkflowInstanceStatus(ctx, instanceID)
	if err != nil {
		return err
	}
	c := &output.Console{}
	return c.OutputWorkflowInstanceStatus(status)
}