Skip to content

Commit

Permalink
fix: environment and feature names in pixi info --json (#857)
Browse files Browse the repository at this point in the history
Changes the output of `project info --json` to output proper environment
names:

before: 

```json
{
      "name": {
        "Named": "pl017"
      },
      "features": [
        {
          "Named": "pl017"
        },
        {
          "Named": "py310"
        },
        {
          "Named": "test"
        },
        "Default"
      ],
```

after:

```json
{
      "name": "pl017",
      "features": [
        "pl017",
        "py310",
        "test",
        "default"
      ],
```

Im also wondering if the `"default"` feature should be include in the
above list ..
  • Loading branch information
baszalmstra authored Feb 26, 2024
1 parent 4b1736d commit 8d38155
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
5 changes: 3 additions & 2 deletions src/project/manifest/environment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@ use crate::utils::spanned::PixiSpanned;
use lazy_static::lazy_static;
use miette::Diagnostic;
use regex::Regex;
use serde::{self, Deserialize, Deserializer, Serialize};
use serde::{self, Deserialize, Deserializer};
use serde_with::SerializeDisplay;
use std::borrow::Borrow;
use std::fmt;
use std::hash::{Hash, Hasher};
use std::str::FromStr;
use thiserror::Error;

/// The name of an environment. This is either a string or default for the default environment.
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize)]
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, SerializeDisplay)]
pub enum EnvironmentName {
Default,
Named(String),
Expand Down
6 changes: 3 additions & 3 deletions src/project/manifest/feature.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ use indexmap::IndexMap;
use itertools::Either;
use rattler_conda_types::{NamelessMatchSpec, PackageName, Platform};
use serde::de::Error;
use serde::{Deserialize, Deserializer, Serialize};
use serde_with::serde_as;
use serde::{Deserialize, Deserializer};
use serde_with::{serde_as, SerializeDisplay};
use std::borrow::{Borrow, Cow};
use std::collections::HashMap;
use std::fmt;

/// The name of a feature. This is either a string or default for the default feature.
#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Ord, Hash, Serialize, Default)]
#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Ord, Hash, SerializeDisplay, Default)]
pub enum FeatureName {
#[default]
Default,
Expand Down

0 comments on commit 8d38155

Please sign in to comment.