Skip to content

Commit

Permalink
Opt spec parse
Browse files Browse the repository at this point in the history
Signed-off-by: lucklove <gnu.crazier@gmail.com>
  • Loading branch information
lucklove committed Jul 18, 2020
1 parent d1e26f6 commit eed9b07
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions cmd/mirror.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
"path/filepath"
"runtime"
"sort"
"strings"
"time"

"github.com/pingcap/errors"
Expand Down Expand Up @@ -254,22 +253,16 @@ func newMirrorModifyCmd() *cobra.Command {
return err
}

spec := strings.Split(args[0], ":")
component := spec[0]
version := ""
if len(spec) > 1 {
version = spec[1]
}

m, err := env.V1Repository().FetchComponentManifest(component)
comp, ver := environment.ParseCompVersion(args[0])
m, err := env.V1Repository().FetchComponentManifest(comp)
if err != nil {
return err
}

if endpoint == "" {
endpoint = environment.Mirror()
}
e := remote.NewEditor(endpoint, component).WithDesc(desc).WithVersion(version)
e := remote.NewEditor(endpoint, comp).WithDesc(desc).WithVersion(ver.String())
flagSet := set.NewStringSet()
cmd.Flags().Visit(func(f *pflag.Flag) {
flagSet.Insert(f.Name)
Expand Down

0 comments on commit eed9b07

Please sign in to comment.