Skip to main content

uv_configuration/
output_format.rs

1/// The output format for listing Python installations.
2#[derive(Debug, Default, Clone, Copy)]
3#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
4pub enum PythonListFormat {
5    /// Plain text (for humans).
6    #[default]
7    Text,
8    /// JSON (for computers).
9    Json,
10}
11
12/// The output format for audit findings.
13#[derive(Debug, Default, Clone, Copy)]
14#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
15pub enum AuditOutputFormat {
16    /// Display the result in a human-readable format.
17    #[default]
18    Text,
19    /// Display the result in JSON format.
20    Json,
21    /// Display the result in SARIF format.
22    Sarif,
23}
24
25#[derive(Debug, Clone, Copy)]
26#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
27pub enum VersionFormat {
28    /// Display the version as plain text.
29    Text,
30    /// Display the version as JSON.
31    Json,
32}
33
34#[derive(Debug, Default, Clone, Copy)]
35#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
36pub enum SyncFormat {
37    /// Display the result in a human-readable format.
38    #[default]
39    Text,
40    /// Display the result in JSON format.
41    Json,
42}
43
44#[derive(Debug, Default, Clone, Copy)]
45#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
46pub enum PipInstallFormat {
47    /// Display the result in a human-readable format.
48    #[default]
49    Text,
50    /// Display the result in JSON format.
51    Json,
52}
53
54#[derive(Debug, Default, Clone, Copy, PartialEq, Eq)]
55#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
56pub enum TreeFormat {
57    /// Display the dependency graph as a human-readable tree.
58    #[default]
59    Text,
60    /// Display the dependency graph as JSON.
61    Json,
62}
63
64/// The output version for workspace metadata. The default is the latest supported version.
65#[derive(Debug, Default, Clone, Copy, serde::Serialize)]
66#[serde(rename_all = "snake_case")]
67pub enum MetadataOutputVersion {
68    /// An unstable, experimental schema.
69    #[default]
70    Preview,
71}
72
73impl From<&str> for MetadataOutputVersion {
74    fn from(version: &str) -> Self {
75        match version {
76            "preview" => Self::Preview,
77            _ => Self::default(),
78        }
79    }
80}
81
82#[derive(Debug, Default, Clone)]
83#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
84pub enum ListFormat {
85    /// Display the list of packages in a human-readable table.
86    #[default]
87    Columns,
88    /// Display the list of packages in a `pip freeze`-like format, with one package per line
89    /// alongside its version.
90    Freeze,
91    /// Display the list of packages in a machine-readable JSON format.
92    Json,
93}