Skip to content

Commit

Permalink
conan list --format=compact docs (#3446)
Browse files Browse the repository at this point in the history
  • Loading branch information
memsharded authored Nov 6, 2023
1 parent e80986b commit 76e9647
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
2 changes: 2 additions & 0 deletions reference/commands/cache.rst
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@ Again, the "build" folder will only exist if the package was built from source.
package storage must be considered **read-only**. Do not modify, change, remove or add files from the cache.
- If you are using this command to obtain the path to artifacts and then copying them, consider the usage of a ``deployer``
instead. In the general case, extracting artifacts from the cache manually is discouraged.
- Developers can use the ``conan list ... --format=compact`` to get the full references in a compact way that can
be copied and pasted into the ``conan cache path`` command


conan cache clean
Expand Down
31 changes: 30 additions & 1 deletion reference/commands/list.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ conan list
-vnotice, -vstatus, -v or -vverbose, -vv or -vdebug,
-vvv or -vtrace
-f FORMAT, --format FORMAT
Select the output format: json, html
Select the output format: json, html, compact
-p PACKAGE_QUERY, --package-query PACKAGE_QUERY
List only the packages matching a specific query, e.g,
os=Windows AND (arch=x86 OR compiler=gcc)
Expand Down Expand Up @@ -410,3 +410,32 @@ with the following structure:
Here is the rendered generated HTML.

.. image:: ../../images/conan-list-html.png


List compact output format
--------------------------

For developers, it can be convenient to use the ``--format=compact`` output, because it allows to copy and paste
full references into other commands (like for example ``conan cache path``):

.. code-block:: text
$ conan list "zlib/1.2.13:*" -r=conancenter --format=compact
conancenter
zlib/1.2.13
zlib/1.2.13#97d5730b529b4224045fe7090592d4c1 (2023-08-22 02:51:57 UTC)
zlib/1.2.13#97d5730b529b4224045fe7090592d4c1:d62dff20d86436b9c58ddc0162499d197be9de1e
settings: Macos, x86_64, Release, apple-clang, 13
options(diff): fPIC=True, shared=False
zlib/1.2.13#97d5730b529b4224045fe7090592d4c1:abe5e2b04ea92ce2ee91bc9834317dbe66628206
settings: Linux, x86_64, Release, gcc, 11
options(diff): shared=True
zlib/1.2.13#97d5730b529b4224045fe7090592d4c1:ae9eaf478e918e6470fe64a4d8d4d9552b0b3606
settings: Windows, x86_64, Release, msvc, dynamic, Release, 192
options(diff): shared=True
...
The ``--format=compact`` will show the list of values for ``settings``, and it will only show the differences ("diff")
for options, that is, it will compute the common denominator of options for all displayed packages, and will print
only those values that deviate from that common denominator.

0 comments on commit 76e9647

Please sign in to comment.