Skip to content

Commit 1a96638

Browse files
Inline default into main
There's not much point in having a special module if there is no such subcommand anymore.
1 parent 75f8248 commit 1a96638

File tree

3 files changed

+38
-108
lines changed

3 files changed

+38
-108
lines changed

Diff for: bin/default.ml

-78
This file was deleted.

Diff for: bin/default.mli

-25
This file was deleted.

Diff for: bin/main.ml

+38-5
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
%%NAME%% %%VERSION%%
55
---------------------------------------------------------------------------*)
66

7+
open Bos_setup.R.Infix
78
open Cmdliner
89

910
let cmds =
@@ -32,9 +33,13 @@ let man =
3233
[
3334
`S Manpage.s_description;
3435
`P "$(mname) releases dune packages to opam.";
35-
`P
36-
"Without arguments, $(mname) acts like $(b,dune-release bistro): refer \
37-
to $(b,dune-release help bistro) for help about the default behavior.";
36+
`P "The $(mname) command is equivalent to the invokation of:";
37+
`Pre
38+
"dune-release distrib # Create the distribution archive\n\
39+
dune-release publish # Publish it on the WWW with its documentation\n\
40+
dune-release opam pkg # Create an opam package\n\
41+
dune-release opam submit # Submit it to OCaml's opam repository";
42+
`P "See dune-release(7) for more information.";
3843
`P "Use '$(mname) help release' for help to release a package.";
3944
`Noblank;
4045
`P "Use '$(mname) help troubleshoot' for a few troubleshooting tips.";
@@ -46,9 +51,37 @@ let man =
4651
`P "Daniel C. Buenzli, $(i,http://erratique.ch)";
4752
]
4853

54+
(* Only carry on when the first operation returns 0 *)
55+
let ( >! ) x f = match x with Ok 0 -> f () | _ -> x
56+
57+
let auto () (`Dry_run dry_run) (`Package_names pkg_names)
58+
(`Package_version version) (`Dist_tag tag) (`Keep_v keep_v) (`Token token)
59+
(`Include_submodules include_submodules) (`Draft draft)
60+
(`Local_repo local_repo) (`Remote_repo remote_repo) (`Opam_repo opam_repo)
61+
(`No_auto_open no_auto_open) =
62+
Cli.handle_error
63+
( Dune_release.Config.token ~token ~dry_run () >>= fun token ->
64+
let token = Dune_release.Config.Cli.make token in
65+
Distrib.distrib ~dry_run ~pkg_names ~version ~tag ~keep_v ~keep_dir:false
66+
~skip_lint:false ~skip_build:false ~skip_tests:false ~include_submodules
67+
()
68+
>! fun () ->
69+
Publish.publish ~token ~pkg_names ~version ~tag ~keep_v ~dry_run
70+
~publish_artefacts:[] ~yes:false ~draft ()
71+
>! fun () ->
72+
Opam.get_pkgs ~dry_run ~keep_v ~tag ~pkg_names ~version () >>= fun pkgs ->
73+
Opam.pkg ~dry_run ~pkgs () >! fun () ->
74+
Opam.submit ~token ~dry_run ~pkgs ~pkg_names ~no_auto_open ~yes:false
75+
~draft () ?local_repo ?remote_repo ?opam_repo )
76+
77+
let cmd =
78+
Term.(
79+
pure auto $ Cli.setup $ Cli.dry_run $ Cli.pkg_names $ Cli.pkg_version
80+
$ Cli.dist_tag $ Cli.keep_v $ Cli.token $ Cli.include_submodules $ Cli.draft
81+
$ Cli.local_repo $ Cli.remote_repo $ Cli.opam_repo $ Cli.no_auto_open)
82+
4983
let main =
50-
( fst Default.cmd,
51-
Term.info "dune-release" ~version:"%%VERSION%%" ~doc ~sdocs ~exits ~man )
84+
(cmd, Term.info "dune-release" ~version:"%%VERSION%%" ~doc ~sdocs ~exits ~man)
5285

5386
let main () = Term.(exit_status @@ eval_choice main cmds)
5487

0 commit comments

Comments
 (0)