Skip to content

Commit

Permalink
skip argu on simple restore
Browse files Browse the repository at this point in the history
  • Loading branch information
matthid committed Aug 26, 2017
1 parent 9ced1f6 commit 827c282
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/Paket/Program.fs
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ type PaketExiter() =
tracen msg ; exit 0
else traceError msg ; exit 1

let processWithValidation silent validateF commandF (result : ParseResults<'T>) =
let processWithValidationEx printUsage silent validateF commandF result =
if not <| validateF result then
traceError "Command was:"
traceError (" " + String.Join(" ",Environment.GetCommandLineArgs()))
result.Parser.PrintUsage() |> traceError
printUsage result

#if NETCOREAPP1_0
// Environment.ExitCode not supported in netcoreapp1.0
Expand Down Expand Up @@ -104,6 +104,10 @@ let processWithValidation silent validateF commandF (result : ParseResults<'T>)
if not verbose && omitted > 0 then
traceWarnfn "Paket omitted '%d' warnings similar to the ones above. You can see them in verbose mode" omitted


let processWithValidation silent validateF commandF (result : ParseResults<'T>) =
processWithValidationEx (fun (r:ParseResults<'T>) -> r.Parser.PrintUsage() |> traceError) silent validateF commandF result

let processCommand silent commandF result =
processWithValidation silent (fun _ -> true) commandF result

Expand Down Expand Up @@ -745,9 +749,14 @@ let main() =
use consoleTrace = Logging.event.Publish |> Observable.subscribe Logging.traceToConsole
let paketVersion = AssemblyVersionInformation.AssemblyInformationalVersion



try
let args = Environment.GetCommandLineArgs()
if args.Length = 1 && args.[0] = "restore" || args.Length = 2 && args.[0] = "--from-bootstrapper" && args.[1] = "restore" then
// fast restore route
// printUsage silent validateF commandF result
processWithValidationEx ignore false (fun _ -> true) (fun _ ->
Dependencies.Locate().Restore(false, None, false, false, false, false, None)) ()
else
let parser = ArgumentParser.Create<Command>(programName = "paket",
helpTextMessage = sprintf "Paket version %s%sHelp was requested:" paketVersion Environment.NewLine,
errorHandler = new PaketExiter())
Expand Down

0 comments on commit 827c282

Please sign in to comment.