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

feat: add explicit flag to CLI list command #1403

Merged
merged 4 commits into from
May 19, 2024
Merged

Conversation

jjjermiah
Copy link
Contributor

implements #1372

feature: add cli flag for pixi list so users can filter only for explicit packages using --explicit , additionally with -x

    -x, --explicit                       Only list packages that are explicitly defined in the project
List project's packages. Highlighted packages are explicit dependencies

Usage: pixi list [OPTIONS] [REGEX]

Arguments:
  [REGEX]  List only packages matching a regular expression

Options:
      --platform <PLATFORM>            The platform to list packages for. Defaults to the current platform
      --json                           Whether to output in json format
      --json-pretty                    Whether to output in pretty json format
      --sort-by <SORT_BY>              Sorting strategy [default: name] [possible values: size, name, kind]
      --manifest-path <MANIFEST_PATH>  The path to 'pixi.toml' or 'pyproject.toml'
  -e, --environment <ENVIRONMENT>      The environment to list packages for. Defaults to the default environment
      --frozen                         [env: PIXI_FROZEN=]
      --locked                         Check if lockfile is up-to-date before installing the environment, aborts when
                                       lockfile isn't up-to-date with the manifest file [env: PIXI_LOCKED=]
      --no-install                     Don't install the environment for pypi solving, only update the lock-file if it can
                                       solve without installing
  -x, --explicit                       Only list packages that are explicitly defined in the project
  -v, --verbose...                     Increase logging verbosity
  -q, --quiet...                       Decrease logging verbosity
      --color <COLOR>                  Whether the log needs to be colored [env: PIXI_COLOR=] [default: auto] [possible
                                       values: always, never, auto]
      --no-progress                    Hide all progress bars [env: PIXI_NO_PROGRESS=]
  -h, --help                           Print help

@jjjermiah jjjermiah marked this pull request as ready for review May 17, 2024 13:59
@tdejager
Copy link
Contributor

Checked it out and works for me!

@tdejager tdejager merged commit 2a11546 into prefix-dev:main May 19, 2024
27 checks passed
@jjjermiah
Copy link
Contributor Author

jjjermiah commented May 19, 2024

Thanks @tdejager I also wanted to see if we could add short args for --json and --json-pretty

so users could use pixi ls -xj or pixi ls -xp

image

a problem I see with using p for json-pretty is the confusion it might cause for the --platform argument

  • one alternative would be capital J but that might also be confusing since theres no capitalized arguments anywhere else in the software
  • another alternative would be to use an alias jp

edit: I can create another issue for this implementation if there arent any glaring problems with this idea

@ruben-arts
Copy link
Contributor

@jjjermiah The json output is for machine readable situations. This most often is used in scripts or code. I would not like to add shortcuts for those. As it mostly confuses readers of code what the actual flags mean while --json-pretty directly tells the reader what they can expect from the command.

@jjjermiah
Copy link
Contributor Author

That makes a lot of sense!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants