diff --git a/src/app/Fake.Windows.Chocolatey/Chocolatey.fs b/src/app/Fake.Windows.Chocolatey/Chocolatey.fs index 38598244ef0..ac23ccd575c 100644 --- a/src/app/Fake.Windows.Chocolatey/Chocolatey.fs +++ b/src/app/Fake.Windows.Chocolatey/Chocolatey.fs @@ -218,6 +218,11 @@ module Fake.Windows.Choco /// Do not prompt for user input or confirmations. Default `true`. /// Equivalent to the `-y` option. NonInteractive: bool + /// Force - force the behavior. Do not use force during normal operation - + /// it subverts some of the smart behavior for commands. Maybe used for pushing + /// packages ot insecure private feeds. Default `false`. + /// Equivalent to the `--force` option. + Force: bool } type private NuspecData = { @@ -319,6 +324,7 @@ module Fake.Windows.Choco ApiKey = null ToolPath = null AdditionalArgs = null + Force = false } let private getPaths = @@ -822,7 +828,31 @@ module Fake.Windows.Choco |> appendWithoutQuotesIfNotNull parameters.Source "--source " |> appendWithoutQuotesIfNotNull parameters.ApiKey "--apikey " |> appendIfTrueWithoutQuotes parameters.NonInteractive "-y" - |> appendWithoutQuotesIfNotNull parameters.AdditionalArgs parameters.AdditionalArgs + |> appendIfTrueWithoutQuotes parameters.Force "--force" + |> appendIfTrueWithoutQuotes (parameters.AdditionalArgs |> String.isNotNullOrEmpty) parameters.AdditionalArgs |> toText callChoco parameters.ToolPath args parameters.Timeout + + /// Call custom choco command + /// ## Parameters + /// - `args` - string that will be appendedn to choco.exe call + /// - `timeout` - parrent process maximum completion time + /// ## Sample usage + /// + /// Target "ChocoPush" (fun _ -> + /// + /// let newSpecFile = ... + /// let args = + /// new StringBuilder() + /// |> append "pack" + /// |> append newSpecFile + /// |> append "-y" + /// |> toText + /// + /// args |> Choco.CallChoco TimeSpan.FromMinutes 1. + /// ) + let CallChoco args timeout = + if args |> isNullOrEmpty then failwith "'args' must not be empty." + + callChoco null args timeout