From 4f7e5b507e1e3f6d8e6decdae5c3bd4864055cf3 Mon Sep 17 00:00:00 2001 From: Aditya Date: Mon, 25 May 2026 15:07:23 +0530 Subject: [PATCH] fix: add --name flag to stop command and remove empty println - Added --name flag to stop command so users can specify which Microcks instance to stop, consistent with start command - Removed unnecessary empty fmt.Println() call Closes #438 Signed-off-by: Aditya --- cmd/stop.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cmd/stop.go b/cmd/stop.go index eaba91fd..75207499 100644 --- a/cmd/stop.go +++ b/cmd/stop.go @@ -12,6 +12,7 @@ import ( func NewStopCommand(globalClientOpts *connectors.ClientOptions) *cobra.Command { + var name string var stopCmd = &cobra.Command{ Use: "stop", Short: "stop microcks instance", @@ -27,7 +28,7 @@ func NewStopCommand(globalClientOpts *connectors.ClientOptions) *cobra.Command { return } - ctx, err := localConfig.ResolveContext("") + ctx, err := localConfig.ResolveContext(name) errors.CheckError(err) instance := ctx.Instance @@ -45,7 +46,7 @@ func NewStopCommand(globalClientOpts *connectors.ClientOptions) *cobra.Command { log.Fatalf("Failed to stop a container: %v", err) return } - fmt.Println("") + log.Printf("Instance %s stopped successfully", instance.Name) // update configs @@ -72,6 +73,7 @@ func NewStopCommand(globalClientOpts *connectors.ClientOptions) *cobra.Command { errors.CheckError(err) }, } + stopCmd.Flags().StringVar(&name, "name", "", "Name of the Microcks instance to stop") return stopCmd }