ocaml / opam

opam is a source-based package manager. It supports multiple simultaneous compiler installations, flexible package constraints, and a Git-friendly development workflow.
https://opam.ocaml.org
Other
1.21k stars 348 forks source link

opam show --raw --field without quotes #5929

Open kit-ty-kate opened 2 months ago

kit-ty-kate commented 2 months ago

For use in scripts, it would be nice to return values returned by opam show --raw --field without any qutotes.

For example opam show --raw -f url.src ppxlib returns:

"https://github.com/ocaml-ppx/ppxlib/releases/download/0.32.0/ppxlib-0.32.0.tbz"

and it would be nice if it returned

https://github.com/ocaml-ppx/ppxlib/releases/download/0.32.0/ppxlib-0.32.0.tbz
kit-ty-kate commented 2 months ago

From dev meeting: the behaviour of:

is not clear. We might also want to error in case there is a newline character in case of lists. We might also want to think about interractions with --normalise

rjbou commented 2 months ago

Some outputs that show the non standardised behaviour:

$ opam show --raw -f version ppxlib 
"0.32.1~5.2preview"
$ opam show --raw -f version: ppxlib 

$ opam show  -f version: ppxlib 
"0.32.1~5.2preview"
$ opam show  -f version ppxlib 
0.32.1~5.2preview
$ opam show  -f url.src ppxlib 
[ERROR] No printer for "url.src"
$ opam show  -f url.src: ppxlib 
"https://github.com/ocaml-ppx/ppxlib/archive/04e050cbe2cf3e5cdb4441c480e4f472a5033941.tar.gz"

$ opam show  -f authors: ppxlib 
"Jane Street Group, LLC <opensource@janestreet.com>"
$ opam show  -f authors ppxlib 
"Jane Street Group, LLC <opensource@janestreet.com>"
$ opam show  -f authors opam
[ERROR] No package matching opam found
$ opam show  -f authors opam-devel
"David Allsopp <david@tarides.com>"
"Vincent Bernardoff <vb@luminar.eu.org>"
"Raja Boujbel <raja.boujbel@ocamlpro.com>"
"Kate Deplaix <kit-ty-kate@outlook.com>"
"Roberto Di Cosmo <roberto@dicosmo.org>"
"Thomas Gazagnaire <thomas@gazagnaire.org>"
"Louis Gesbert <louis.gesbert@ocamlpro.com>"
"Fabrice Le Fessant <Fabrice.Le_fessant@inria.fr>"
"Anil Madhavapeddy <anil@recoil.org>"
"Guillem Rieu <guillem.rieu@ocamlpro.com>"
"Ralf Treinen <ralf.treinen@pps.jussieu.fr>"
"Frederic Tuong <tuong@users.gforge.inria.fr>"
$ opam show  -f authors: opam-devel
"David Allsopp <david@tarides.com>"
"Vincent Bernardoff <vb@luminar.eu.org>"
"Raja Boujbel <raja.boujbel@ocamlpro.com>"
"Kate Deplaix <kit-ty-kate@outlook.com>"
"Roberto Di Cosmo <roberto@dicosmo.org>"
"Thomas Gazagnaire <thomas@gazagnaire.org>"
"Louis Gesbert <louis.gesbert@ocamlpro.com>"
"Fabrice Le Fessant <Fabrice.Le_fessant@inria.fr>"
"Anil Madhavapeddy <anil@recoil.org>"
"Guillem Rieu <guillem.rieu@ocamlpro.com>"
"Ralf Treinen <ralf.treinen@pps.jussieu.fr>"
"Frederic Tuong <tuong@users.gforge.inria.fr>"

$