From 2dfbe17b972bf0f577071f1d59744da7f769d9f4 Mon Sep 17 00:00:00 2001 From: Praveen Kumar <42026111+Praveen005@users.noreply.github.com> Date: Thu, 11 Jul 2024 23:32:21 +0530 Subject: [PATCH] fix: display correct region in message when no resources are found (#440) Print the value of the region flag (if set) instead of the default region. --- utility/output_writer.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/utility/output_writer.go b/utility/output_writer.go index 4ee9f0fe..3210e9a0 100644 --- a/utility/output_writer.go +++ b/utility/output_writer.go @@ -287,7 +287,12 @@ func prettyprint(b []byte) ([]byte, error) { func (ow *OutputWriter) FinishAndPrintOutput() { ow.finishExistingLine() if len(ow.Values) == 0 { - region := config.Current.Meta.DefaultRegion + var region string + if common.RegionSet != "" { + region = common.RegionSet + } else { + region = config.Current.Meta.DefaultRegion + } fmt.Fprintf(os.Stderr, "No resources found in region %s. For a list of regions use the command 'civo region ls'\n", region) } else { switch common.OutputFormat {