diff --git a/action.yml b/action.yml index 4d1ca96..7947724 100644 --- a/action.yml +++ b/action.yml @@ -4,16 +4,17 @@ inputs: version: description: 'The version of hd' required: false - default: 'v0.0.68' + default: 'v0.0.69' tool: description: 'The desired tool name' required: true runs: using: 'docker' - image: 'docker://ghcr.io/linuxsuren/hd:v0.0.68' + image: 'docker://ghcr.io/linuxsuren/hd:v0.0.69' args: - hd - - get + - install - ${{ inputs.tool }} - --fetch=true - - --output=/github/home/${{ inputs.tool }} + - --target=/github/home/ + - --force diff --git a/cmd/install.go b/cmd/install.go index 6b9923d..292e373 100644 --- a/cmd/install.go +++ b/cmd/install.go @@ -49,6 +49,7 @@ Cannot find your desired package? Please run command: hd fetch --reset, then try "Indicate if install it via go install github.com/xxx/xxx") flags.StringVarP(&opt.fromBranch, "from-branch", "", "master", "Only works if the flag --from-source is true") + flags.StringVarP(&opt.target, "target", "", "/usr/local/bin", "The target installation directory") flags.BoolVarP(&opt.goget, "goget", "", viper.GetBool("fetch"), "Use command goget to download the binary, only works if the flag --from-source is true") @@ -76,6 +77,7 @@ type installOption struct { CleanPackage bool fromSource bool fromBranch string + target string goget bool force bool @@ -159,6 +161,9 @@ func (o *installOption) install(cmd *cobra.Command, args []string) (err error) { } } + if o.target != "" { + o.Package.TargetDirectory = o.target + } if o.Package.TargetDirectory == "" { o.Package.TargetDirectory = "/usr/local/bin" }