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

PowerShell: Multiple Formater / Output does not work #2553

Open
LasneF opened this issue Nov 15, 2023 · 7 comments · Fixed by #2575
Open

PowerShell: Multiple Formater / Output does not work #2553

LasneF opened this issue Nov 15, 2023 · 7 comments · Fixed by #2575
Assignees
Labels
documentation t/bug Something isn't working

Comments

@LasneF
Copy link

LasneF commented Nov 15, 2023

Describe the bug
the feature leveraging multiple formater / output is broken

To Reproduce

  • spectral lint openapi.yaml -r .spectral.yaml -f junit,html

returns
Invalid values:
Argument: format, Given: "junit html", Choices: "json", "stylish", "junit", "html", "text", "teamcity", "pretty", "github-actions", "sarif

notice i provided a coma , but the is mentionning a space

  • spectral lint openapi.yaml -r .spectral.yaml -f junit -f html -o a.junit -o a.html

return
Multiple outputs have to be provided when more than a single format is specified

looks several -f is correctly interpreting as multiple formater , but not multiple output

  • spectral lint openapi.yaml -r .spectral.yaml -f junit -f html -o a.junit,a.html

Returns
The number of outputs must match the number of formats

at the end i do not have found the right combination that make the multiple output working (target junit, html and stdout)

Expected behavior
command line working like this

i can provide either -f junit,html or -f junit -f html , and same for output

documentation for the stdout output
documentation with a basic sample with for instance stdout + a formater *

notice as well that in the simple case
spectral lint openapi.yaml -r .spectral.yaml -f junit -o a.junit -q true

leveraging -q true or false as no impact , wheras i would expect it has (my target beeing output on stdout + html file)

**Environment **
spectral --version : 6.11.0

@kiranpatel11
Copy link

+1

Invalid values:
  Argument: format, Given: "json,junit", Choices: "json", "stylish", "junit", "html", "text", "teamcity", "pretty", "github-actions", "sarif"

@mnaumanali94 mnaumanali94 added the t/bug Something isn't working label Nov 29, 2023
@mnaumanali94
Copy link
Contributor

The documentation is incorrect. The command needs to be -f json -f text. We'll use this issue to update the docs.

@mnaumanali94 mnaumanali94 self-assigned this Jan 2, 2024
@quadrrem
Copy link

Ran in the same issue. And also the documentation for multiple outputs (in combination with multiple formats) seems hard to understand

-o, --output                   where to output results, can be a single file name, multiple "output.<format>" or missing to print to stdout

For the part of "multiple "output."" it was not clear to me that this was referring to the output parameter itself and not the value that is passed with the parameter. Maybe an example in the documentation could help clear things up.

@LasneF a working command for your usecase would be

spectral lint openapi.yaml -r .spectral.yaml  -f junit -f html -o.junit a.xml -o.html a.html

@P0lip P0lip self-assigned this Jan 16, 2024
@LasneF
Copy link
Author

LasneF commented Jan 17, 2024

@P0lip are you sure it is only documentation ;
the command line you provides does not work on my side

image

using spectral v6.11.0
running on windows

@P0lip
Copy link
Contributor

P0lip commented Jan 17, 2024

@LasneF Could you try changing the shell to a Unix one like bash or zsh and see if it works? It might be possibly related to PowerShell - I don't know how it behaves there. There's a chance it gets parsed differently.
I tried running a very similar command to yours and it completed just fine, but that's on Unix shell.

image

@LasneF
Copy link
Author

LasneF commented Jan 24, 2024

@P0lip testing on Linux looks working , so this is a powershell topic , to me it deserve the bug to be re open , or to create a dedicated one on windows , as it is still a widely used platform

@P0lip
Copy link
Contributor

P0lip commented Feb 2, 2024

@LasneF I'll follow up with that next week.
I agree it's something we should at the very least document and offer a workaround.

@P0lip P0lip reopened this Feb 14, 2024
@P0lip P0lip changed the title Multiple Formater / Output does not work PowerShell: Multiple Formater / Output does not work Feb 14, 2024
@stoplightio stoplightio deleted a comment from stoplight-bot Apr 4, 2024
@P0lip P0lip removed the released label Apr 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation t/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants