diff --git a/cli/azd/internal/cmd/provision.go b/cli/azd/internal/cmd/provision.go index 25265aa4124..81ba6bb9078 100644 --- a/cli/azd/internal/cmd/provision.go +++ b/cli/azd/internal/cmd/provision.go @@ -7,6 +7,7 @@ import ( "log" "os" "strconv" + "strings" "time" "github.com/azure/azure-dev/cli/azd/cmd/actions" @@ -166,14 +167,14 @@ func (p *ProvisionAction) SetFlags(flags *ProvisionFlags) { func (p *ProvisionAction) Run(ctx context.Context) (*actions.ActionResult, error) { var targetServiceName string if len(p.args) == 1 { - targetServiceName = p.args[0] + targetServiceName = strings.TrimSpace(p.args[0]) } if targetServiceName != "" && p.flags.all { return nil, fmt.Errorf("cannot specify both --all and ") } - if targetServiceName == "" && p.flags.platform { + if targetServiceName != "" && p.flags.platform { return nil, fmt.Errorf("cannot specify both --platform and ") } diff --git a/cli/azd/internal/cmd/util.go b/cli/azd/internal/cmd/util.go index aae93fae3df..1a429c75bdc 100644 --- a/cli/azd/internal/cmd/util.go +++ b/cli/azd/internal/cmd/util.go @@ -4,8 +4,6 @@ import ( "context" "errors" "fmt" - "os" - "strconv" "time" "github.com/azure/azure-dev/cli/azd/internal/tracing" @@ -34,19 +32,22 @@ func getResourceGroupFollowUp( projectConfig.ResourceGroupName, ) if err == nil { - suffix := ":\n" + azurePortalLink(portalUrlBase, subscriptionId, resourceGroupName) - - if v, err := strconv.ParseBool(os.Getenv("AZD_DEMO_MODE")); err == nil && v { - suffix = "." - } + resourceGroupLink := azurePortalLink(portalUrlBase, subscriptionId, resourceGroupName) + azurePortalHyperlink := output.WithHyperlink(resourceGroupLink, "Azure Portal") defaultFollowUpText := fmt.Sprintf( - "You can view the resources created under the resource group %s in Azure Portal", resourceGroupName) + "You can view the resources created under the resource group %s in the %s", + output.WithHighLightFormat(resourceGroupName), + azurePortalHyperlink, + ) if whatIf { defaultFollowUpText = fmt.Sprintf( - "You can view the current resources under the resource group %s in Azure Portal", resourceGroupName) + "You can view the current resources under the resource group %s in the %s", + output.WithHighLightFormat(resourceGroupName), + azurePortalHyperlink, + ) } - followUp = defaultFollowUpText + suffix + followUp = defaultFollowUpText } return followUp @@ -56,11 +57,11 @@ func azurePortalLink(portalUrlBase, subscriptionId, resourceGroupName string) st if subscriptionId == "" || resourceGroupName == "" { return "" } - return output.WithLinkFormat(fmt.Sprintf( + return fmt.Sprintf( "%s/#@/resource/subscriptions/%s/resourceGroups/%s/overview", portalUrlBase, subscriptionId, - resourceGroupName)) + resourceGroupName) } func getTargetServiceName( diff --git a/cli/azd/pkg/output/ux/environment_details.go b/cli/azd/pkg/output/ux/environment_details.go index 2ed28e45203..7105901e031 100644 --- a/cli/azd/pkg/output/ux/environment_details.go +++ b/cli/azd/pkg/output/ux/environment_details.go @@ -6,9 +6,9 @@ package ux import ( "encoding/json" "fmt" + "strings" "github.com/azure/azure-dev/cli/azd/pkg/output" - "github.com/fatih/color" ) type EnvironmentDetails struct { @@ -17,15 +17,14 @@ type EnvironmentDetails struct { } func (t *EnvironmentDetails) ToString(currentIndentation string) string { - var location string + lines := []string{} if t.Location != "" { - location = fmt.Sprintf("\nLocation: %s", color.BlueString(t.Location)) + lines = append(lines, fmt.Sprintf("Location: %s", output.WithHighLightFormat(t.Location))) } - return fmt.Sprintf( - "Subscription: %s%s\n", - color.BlueString(t.Subscription), - location, - ) + + lines = append(lines, fmt.Sprintf("Subscription: %s", output.WithHighLightFormat(t.Subscription))) + + return strings.Join(lines, "\n") + "\n" } func (t *EnvironmentDetails) MarshalJSON() ([]byte, error) {