Skip to content

Commit

Permalink
Unix.wget: added --user-agent option
Browse files Browse the repository at this point in the history
  • Loading branch information
pveber committed Jul 25, 2019
1 parent 6c9397e commit 52afaec
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
11 changes: 6 additions & 5 deletions lib/unix/bistro_unix.ml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ open Printf
let ident x = x

module Cmd = struct
let wget ?no_check_certificate ?user ?password ?dest url =
let wget ?no_check_certificate ?user_agent ?user ?password ?dest url =
cmd "wget" [
option (flag string "--no-check-certificate") no_check_certificate ;
option (opt "--user-agent" string) user_agent ;
option (opt "--user" string) user ;
option (opt "--password" string) password ;
option (opt "-O" ident) dest ;
Expand All @@ -19,14 +20,14 @@ module Cmd = struct
seq ~sep:"" [ string "<(gunzip -c " ; dep x ; string ";)" ]
end

let wget_dyn ?descr_url ?no_check_certificate ?user ?password url =
let wget_dyn ?descr_url ?no_check_certificate ?user_agent ?user ?password url =
let info = match descr_url with None -> "" | Some i -> sprintf "(%s)" i in
Workflow.shell ~descr:("unix.wget" ^ info) [
Cmd.wget ?no_check_certificate ?user ?password ~dest url
Cmd.wget ?no_check_certificate ?user_agent ?user ?password ~dest url
]

let wget ?descr_url ?no_check_certificate ?user ?password url =
wget_dyn ?descr_url ?no_check_certificate ?user ?password (Workflow.string url)
let wget ?descr_url ?no_check_certificate ?user_agent ?user ?password url =
wget_dyn ?descr_url ?no_check_certificate ?user_agent ?user ?password (Workflow.string url)

let unzip zip =
Workflow.shell ~descr:"unix.unzip" [
Expand Down
3 changes: 3 additions & 0 deletions lib/unix/bistro_unix.mli
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ open Bistro
module Cmd : sig
val wget :
?no_check_certificate:bool ->
?user_agent:string ->
?user:string ->
?password:string ->
?dest:Shell_dsl.template ->
Expand All @@ -14,13 +15,15 @@ end
val wget :
?descr_url:string ->
?no_check_certificate:bool ->
?user_agent:string ->
?user:string ->
?password:string ->
string -> #file pworkflow

val wget_dyn :
?descr_url:string ->
?no_check_certificate:bool ->
?user_agent:string ->
?user:string ->
?password:string ->
string workflow -> #file pworkflow
Expand Down

0 comments on commit 52afaec

Please sign in to comment.