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

Support option "--output" for command "get chaos-experiments" #223

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

OhRaph
Copy link

@OhRaph OhRaph commented Apr 24, 2024

The value of flag "--output" isn't evaluated when using command "get chaos-experiments".

This is the behavior we have:

litmusctl get chaos-experiments --project-id "066950eb-0914-49b1-8bda-b652f86cb7ab" -o="yaml"
Use the arrow keys to navigate: ↓ ↑ → ← 
? Select an output format: 
  ▸ table
    json
    yaml

Moreover:

  • the value "table" isn't mentioned in the doc
  • there is no guard to check the validity of the value provided in option "--output"

I propose to add these changes.

Note: I'm not familiar with Go language. The code I provide is mainly derived from existing one, and I've search on Internet to achieve some part I could do by myself.

Please feel free to improve it as you want.
By advance, sorry for the possible mistakes I've made.

@OhRaph
Copy link
Author

OhRaph commented Apr 24, 2024

I can see that this PR is already addressing the non evaluation of flag "--output".
But it's doesn't ensure that the value provided by argument is valid.

@Nageshbansal
Copy link
Collaborator

@shivam-Purohit could you PTAL

utils.PrintError(err)

if outputFormat == "" {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could also merge the if statements into one to get rid of repeating promptui code. if == "" &&
Maybe something like input a valid output format

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