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

Does the command "nx show projects" return a list separated by new line by default? #22219

Closed
4 tasks
vcardins opened this issue Mar 7, 2024 · 3 comments · Fixed by #23172
Closed
4 tasks
Labels
community This is a good first issue for contributing scope: core core nx functionality type: feature

Comments

@vcardins
Copy link

vcardins commented Mar 7, 2024

Current Behavior

Maybe it's by design, but when I run the command npx nx show projects --affected --type=app --base=$NX_BASE --head=$NX_HEAD it returns a list of apps separated by new line "\n", however, I wished it was separated by comma.

Current output:
app1
app2
app3

Expected Behavior

As the expected behaviour, I'd like to (either by default), pass a parameter which sets the separation character.

As a workaround, I'm doing $(npx nx show projects --affected --type=app --base=$NX_BASE --head=$NX_HEAD | tr '\n' ',' | sed 's/,$//')

which outputs: app1,app2,app3

GitHub Repo

No response

Steps to Reproduce

  1. Run the command npx nx show projects --affected --type=app --base=$NX_BASE --head=$NX_HEAD
  2. Notice the output is separated by new line

Nx Report

Node   : 20.11.1
OS     : darwin-arm64
yarn   : 1.22.19

nx                 : 18.0.6
@nx/js             : 18.0.6
@nx/jest           : 18.0.6
@nx/linter         : 18.0.6
@nx/eslint         : 18.0.6
@nx/workspace      : 18.0.6
@nx/devkit         : 18.0.6
@nx/eslint-plugin  : 18.0.6
@nx/playwright     : 18.0.6
@nx/react          : 18.0.6
@nrwl/tao          : 18.0.6
@nx/web            : 18.0.6
@nx/webpack        : 18.0.6
typescript         : 5.3.3

Failure Logs

No response

Package Manager Version

1.22.1

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

No response

@FrozenPandaz FrozenPandaz added type: feature community This is a good first issue for contributing scope: core core nx functionality and removed type: bug labels Mar 15, 2024
@FrozenPandaz
Copy link
Collaborator

Would you like to add a --sep option for nx show which would be used in that case? It would have no effect when printing json or using the --web option.

@vcardins
Copy link
Author

@FrozenPandaz Not sure I understand you. Do you mean something like
npx nx show projects --affected --type=app --sep "," it didn't work

@FrozenPandaz
Copy link
Collaborator

Sorry, I was unclear.

There currently is no way to change the separator used. However, if you would like to add the feature, it would be a --sep flag. A PR would be welcome 👍

dasco144 added a commit to dasco144/nx that referenced this issue May 3, 2024
…with provided character

`npx nx show projects --affected --type=app --sep ","` will output the affected projects with a ","
seperating each project ouput

closed nrwl#22219
dasco144 added a commit to dasco144/nx that referenced this issue May 3, 2024
…d character

`npx nx show projects --affected --type=app --sep ","` will output the affected projects with a ","
seperating each project ouput

closed nrwl#22219
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community This is a good first issue for contributing scope: core core nx functionality type: feature
Projects
None yet
2 participants