From 5de69f94ee1806c5494ae2783db9f92dd588c617 Mon Sep 17 00:00:00 2001 From: baurine <2008.hbl@gmail.com> Date: Mon, 19 Apr 2021 10:21:45 +0800 Subject: [PATCH] mirror: add `tiup mirror show` command to print current mirror address --- cmd/mirror.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/cmd/mirror.go b/cmd/mirror.go index 9dca968b44..a0a7f6e6df 100644 --- a/cmd/mirror.go +++ b/cmd/mirror.go @@ -66,6 +66,7 @@ of components or the repository itself.`, newMirrorCloneCmd(), newMirrorMergeCmd(), newMirrorPublishCmd(), + newMirrorShowCmd(), newMirrorSetCmd(), newMirrorModifyCmd(), newMirrorGrantCmd(), @@ -139,6 +140,21 @@ func newMirrorSignCmd() *cobra.Command { return cmd } +// the `mirror show` sub command +func newMirrorShowCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "show", + Short: "Show mirror address", + Long: `Show current mirror address`, + RunE: func(cmd *cobra.Command, args []string) error { + fmt.Println(environment.Mirror()) + return nil + }, + } + + return cmd +} + // the `mirror set` sub command func newMirrorSetCmd() *cobra.Command { var (