Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add conan version command #3243

Merged
merged 2 commits into from
Jun 1, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion reference/commands.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Commands

This section describe the Conan built-in commands, like ``conan install`` or ``conan search``.

It is also possible to create user custom commands, visit :ref:`custom commands reference <reference_commands_custom_commands>`
It is also possible to create user custom commands, visit :ref:`custom commands reference <reference_commands_custom_commands>`
and these :ref:`custom command examples <examples_extensions_custom_commands>`


Expand All @@ -27,6 +27,7 @@ and these :ref:`custom command examples <examples_extensions_custom_commands>`
commands/remove
commands/remote
commands/search
commands/version

- :doc:`conan cache <commands/cache>`: Return the path of recipes and packages in the cache
- :doc:`conan config <commands/config>`: Manage Conan configuration (remotes, settings, plugins, etc)
Expand All @@ -39,6 +40,7 @@ and these :ref:`custom command examples <examples_extensions_custom_commands>`
- :doc:`conan remove <commands/remove>`: Remove packages from the local cache or from remotes
- :doc:`conan remote <commands/remote>`: Add, remove, login/logout and manage remote server
- :doc:`conan search <commands/search>`: Search packages matching a name
- :doc:`conan version <commands/version>`: Give information about the Conan client version


**Creator commands:**
Expand Down
44 changes: 44 additions & 0 deletions reference/commands/version.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
.. _reference_commands_inspect:
uilianries marked this conversation as resolved.
Show resolved Hide resolved

conan inspect
uilianries marked this conversation as resolved.
Show resolved Hide resolved
=============

.. include:: ../../common/experimental_warning.inc

.. code-block:: text

$ conan version -h
usage: conan version [-h] [-f FORMAT] [-v [V]]

Give information about the Conan client version.

options:
-h, --help show this help message and exit
-f FORMAT, --format FORMAT
Select the output format: json
-v [V] Level of detail of the output. Valid options from less verbose to more verbose: -vquiet, -verror, -vwarning, -vnotice, -vstatus, -v or -vverbose, -vv or -vdebug, -vvv or -vtrace


The :command:`conan version` command shows the conan version as well the python version from the system:

.. code-block:: text

$ conan version
version: 2.0.6
python
version: 3.10.4
sys_version: 3.10.4 (main, May 17 2022, 10:53:07) [Clang 13.1.6 (clang-1316.0.21.2.3)]


The :command:`conan version --format=json` returns a JSON output format in ``stdout`` (which can be redirected to a file) with the following structure:

.. code-block:: text

$ conan version --format=json
{
"version": "2.0.6",
"python": {
"version": "3.10.4",
"sys_version": "3.10.4 (main, May 17 2022, 10:53:07) [Clang 13.1.6 (clang-1316.0.21.2.3)]"
}
}