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 101aa1d commit 50fa666
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 12 deletions.
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ Unreleased
`.merlin` files. Now dune will never remove `.merlin` files automatically
(#7562)

- Add `dune show env` command and make `dune printenv` an alias of it. (#7985,
@Alizter)

- Add additional metadata to the traces provided by `--trace-file` whenever
`--trace-extended` is passed (#7778, @rleshchinskiy)

Expand Down
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 50fa666

Please sign in to comment.