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

add equivalent to --all cli flag to ignore ts-to-zod config at all #211

Open
vladdcom opened this issue Feb 28, 2024 · 10 comments
Open

add equivalent to --all cli flag to ignore ts-to-zod config at all #211

vladdcom opened this issue Feb 28, 2024 · 10 comments
Labels
breaking v4 This issue introduces a breaking change that would go into v4 enhancement New feature or request

Comments

@vladdcom
Copy link

Feature description

In cli prompt the program has option "Don't use the config" but i cannot use it through inline command ts-to-zod --none or ts-to-zod --config=none doesnt work

Input

ts-to-zod --config=none

Output

ts-to-zod ignore ts-to-zod config and use passed inline data

@tvillaren
Copy link
Collaborator

Hello @vladdcom,

Do you mean that it would just ignore this prompt:

? You have multiple configs available in "ts-to-zod.config.js"
 What do you want? (Use arrow keys)
❯ Execute all configs (--all) 
  Execute "example" config (--config=example) 
  Execute "example/person" config (--config=example/person) 
  Execute "config" config (--config=config)
  Don't use the config 

and be the equivalent of selecting the last option?

@vladdcom
Copy link
Author

yeah, exactly the equivalent of selecting the last option

@tvillaren
Copy link
Collaborator

In that case, you must add arguments to CLI call, right?

At least an input argument (and ideally an output otherwise your input will be overwritten).
Maybe we should skip the config step altogether when an input is passed.

@vladdcom
Copy link
Author

per repo

yarn ts-to-zod --all -> use the ts-to-zod config
yarn ts-to-zod --noneConfig src/iDontTrustThisApi.ts src/nowIcanValidateEverything.ts -> ignore the config, use inline params

"Don't use the config" in the prompt is working the same way

@tvillaren
Copy link
Collaborator

In terms of developer experience, I'm wondering if we actually need the --noConfig flag.

Why not skip config when calling

yarn ts-to-zod src/iDontTrustThisApi.ts src/nowIcanValidateEverything.ts

?

My point being that all the information needed to perform the action is in the command. I think your request is very valid, but I feel that adding a new flag is not the best DevExp.
What do you think?

@vladdcom
Copy link
Author

I have ts-to-zod config in my repo and if I run this command
yarn ts-to-zod src/iDontTrustThisApi.ts src/nowIcanValidateEverything.ts

I'm gonna get into a interactive mode of the prompt. But I want to disable config by one command

@tvillaren
Copy link
Collaborator

I'm gonna get into a interactive mode of the prompt. But I want to disable config by one command

Yes, I think I understand that.
My point is that might be better to disable config if the command actually passes input and output arguments: no need to add a flag for that, it would be the logical behaviour to execute the generation directly.

@vladdcom
Copy link
Author

got it, the idea is good

@schiller-manuel
Copy link
Collaborator

@tvillaren sounds good.
If we implement this, so it would be breaking. Let's collect breaking changes such as this and the exit code 1 upon failure so we can combine those in a v4 release.

@tvillaren
Copy link
Collaborator

Yep, had the same thought 😄
I don't have any permission on this repository, but I would be glad to help tag some features to track what could be added in a V4

@schiller-manuel schiller-manuel added the breaking v4 This issue introduces a breaking change that would go into v4 label Feb 28, 2024
@tvillaren tvillaren added the enhancement New feature or request label Mar 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking v4 This issue introduces a breaking change that would go into v4 enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants