Skip to content

Commit

Permalink
Document the meaning of colored version numbers in the manpage of opa…
Browse files Browse the repository at this point in the history
…m show

Co-authored-by: R. Boujbel <[email protected]>
  • Loading branch information
kit-ty-kate and rjbou committed Jan 20, 2025
1 parent 2aac77d commit f3b90c8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions master_changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ users)
* Manual: add information when flags (`avoid-version`, `deprecated`) were introduced [#6320 @hannesm]
* Add winget command for installing opam [#6338 @tobil4sk]
* Fix broken link to non-existing archlinux community repo [#6361 @juergenhoetzel]
* Document the meaning of colored version numbers in the manpage of `opam show` [#6358 @kit-ty-kate]

## Security fixes

Expand Down
13 changes: 12 additions & 1 deletion src/client/opamCommands.ml
Original file line number Diff line number Diff line change
Expand Up @@ -921,7 +921,18 @@ let show cli =
available packages as well as a short description for each.";
`P "Paths to package definition files or to directories containing package \
definitions can also be specified, in which case the corresponding \
metadata will be shown."
metadata will be shown.";
`P "Note: on terminal supporting it, version numbers can be colored the \
following ways:";
`Noblank;
`I ("-", "Magenta and bold: versions installed the current switch");
`Noblank;
`I ("-", "Bold: versions installed in other switches");
`Noblank;
`I ("-", "Red and crossed: versions not available on the current platform");
`Noblank;
`I ("-", "Gray: versions tagged with the $(i,avoid-version) or \
$(i,deprecated) flag");
] in
let fields =
mk_opt ~cli cli_original ["f";"field"] "FIELDS"
Expand Down
1 change: 1 addition & 0 deletions src/client/opamListCommand.ml
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,7 @@ let field_of_string ~raw =
| Some f -> Field f
| None -> OpamConsole.error_and_exit `Bad_arguments "No printer for %S" s

(* NOTE: upon changes, please update the man page section in opamCommands.ml *)
let version_color st nv =
let installed = (* (in any switch) *)
OpamGlobalState.installed_versions st.switch_global nv.name
Expand Down

0 comments on commit f3b90c8

Please sign in to comment.