@@ -35,7 +35,7 @@ Cannot find your desired package? Please run command: hd fetch --reset, then try
3535
3636 flags := cmd .Flags ()
3737 opt .addFlags (flags )
38- flags .StringVarP (& opt .Category , "category" , "" , "" ,
38+ flags .StringVarP (& opt .Category , "category" , "c " , "" ,
3939 "The category of the potentials packages" )
4040 flags .BoolVarP (& opt .ShowProgress , "show-progress" , "" , true , "If show the progress of download" )
4141 flags .BoolVarP (& opt .AcceptPreRelease , "accept-preRelease" , "" , false ,
@@ -100,14 +100,20 @@ func (o *installOption) preRunE(cmd *cobra.Command, args []string) (err error) {
100100
101101 // try to find if it's a native package
102102 o .nativePackage = os .HasPackage (o .tool )
103- if ! o .nativePackage && o .Category == "" {
104- err = o .downloadOption .preRunE (cmd , args )
105-
106- // try to find the real tool name
107- if o .downloadOption .Package .TargetBinary != "" {
108- o .tool = o .downloadOption .Package .TargetBinary
109- } else if o .downloadOption .Package .Binary != "" {
110- o .tool = o .downloadOption .Package .Binary
103+ if ! o .nativePackage {
104+ if o .Category == "" {
105+ err = o .downloadOption .preRunE (cmd , args )
106+
107+ // try to find the real tool name
108+ if o .downloadOption .Package .TargetBinary != "" {
109+ o .tool = o .downloadOption .Package .TargetBinary
110+ } else if o .downloadOption .Package .Binary != "" {
111+ o .tool = o .downloadOption .Package .Binary
112+ } else {
113+ o .tool = o .downloadOption .Package .Repo
114+ }
115+ } else {
116+ err = o .downloadOption .fetch ()
111117 }
112118 }
113119 return
@@ -195,7 +201,6 @@ func (o *installOption) runE(cmd *cobra.Command, args []string) (err error) {
195201 }
196202
197203 for _ , item := range choose {
198- o .tool = item
199204 if err = o .downloadOption .preRunE (cmd , []string {item }); err != nil {
200205 return
201206 }
@@ -205,6 +210,8 @@ func (o *installOption) runE(cmd *cobra.Command, args []string) (err error) {
205210 o .tool = o .downloadOption .Package .TargetBinary
206211 } else if o .downloadOption .Package .Binary != "" {
207212 o .tool = o .downloadOption .Package .Binary
213+ } else {
214+ o .tool = o .downloadOption .Package .Repo
208215 }
209216
210217 if err = o .install (cmd , []string {item }); err != nil {
0 commit comments