Skip to content

Commit

Permalink
show: add dune show env and make dune printenv an alias of it
Browse files Browse the repository at this point in the history
Signed-off-by: Ali Caglayan <alizter@gmail.com>
  • Loading branch information
Alizter committed Jun 16, 2023
1 parent 761395b commit 0465cd9
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
1 change: 1 addition & 0 deletions bin/describe/describe.ml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ let subcommands =
; Describe_external_lib_deps.command
; Describe_opam_files.command
; Describe_pp.command
; Printenv.command
]

let group =
Expand Down
2 changes: 1 addition & 1 deletion bin/main.ml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ let all : _ Cmdliner.Cmd.t list =
; Print_rules.command
; Utop.command
; Promotion.promote
; Printenv.command
; command_alias Printenv.command Printenv.term "printenv"
; Help.command
; Format_dune_file.command
; Upgrade.command
Expand Down
20 changes: 9 additions & 11 deletions bin/printenv.ml
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
open Stdune
open Import

let doc = "Print the environment of a directory"

let man =
[ `S "DESCRIPTION"
; `P {|$(b,dune printenv DIR) prints the environment of a directory|}
; `Blocks Common.help_secs
]

let info = Cmd.info "printenv" ~doc ~man

let dump sctx ~dir =
let open Action_builder.O in
let+ env = Super_context.dump_env sctx ~dir in
Expand Down Expand Up @@ -88,4 +78,12 @@ let term =
(Dune_engine.Context_name.to_string name)
(pp ~fields) env))

let command = Cmd.v info term
let command =
let doc = "Print the environment of a directory" in
let man =
[ `S "DESCRIPTION"
; `P {|$(b,dune show env DIR) prints the environment of a directory|}
; `Blocks Common.help_secs
]
in
Cmd.v (Cmd.info "env" ~doc ~man) term
2 changes: 2 additions & 0 deletions bin/printenv.mli
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
open Import

val term : unit Term.t

val command : unit Cmd.t

0 comments on commit 0465cd9

Please sign in to comment.