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

How to not format [prompt] #2402

Closed
4 tasks
xiaomuzizier opened this issue Jan 12, 2021 · 13 comments
Closed
4 tasks

How to not format [prompt] #2402

xiaomuzizier opened this issue Jan 12, 2021 · 13 comments
Labels

Comments

@xiaomuzizier
Copy link

xiaomuzizier commented Jan 12, 2021

I want my input to be what the output is

Expected Behavior

when i enter --story=100321

when enter ,it show --story=100321

Current Behavior

when i enter --story=100321

when enter ,it show story='100321'

the '--' is lost and number has quotation marks。

image

Affected packages

  • cli ✅
  • core
  • prompt ✅
  • config-angular

Possible Solution

Steps to Reproduce (for bugs)

  1. First step
  2. Second step

i use @commitlint/prompt-cli with commintlint

image

commitlint.config.js

image
image

Context

Your Environment

"@commitlint/cli": "^11.0.0",
"@commitlint/config-conventional": "^11.0.0",
"@commitlint/prompt-cli": "^11.0.0",

Executable Version
commitlint --version VERSION
git --version VERSION
node --version VERSION

"@commitlint/cli": "^11.0.0",
"@commitlint/config-conventional": "^11.0.0",
"@commitlint/prompt-cli": "^11.0.0",

@escapedcat
Copy link
Member

A subject can't start with -. It should start with a letter.
You might be able to change the behaviour with a plugin.

@xiaomuzizier
Copy link
Author

image

i start with a letter.but i can not work

@meteorlxy
Copy link

meteorlxy commented Jan 12, 2021

Currently, the prompt package is using vorpal.catch to get user input of subject:

prompt.catch('[text...]').action((parameters) => {
const {text = ''} = parameters;
prompt.removeAllListeners();
prompt.ui.redraw.done();
return resolve(forceLeadingBlankFn(forceCaseFn(text.join(' '))));
});

If we input --foo=bar for subject, the text of the parameters has already been transformed to foo='bar'

parameters: {"options":{},"text":["foo='bar'"]}

I'm not sure if a plugin can handle this internal problem of prompt package.

@escapedcat

IMO, this might be a bug of prompt package, as it does not keep user input as is.

@escapedcat
Copy link
Member

@meteorlxy @xiaomuzizier sorry, didn't see this was using prompt. Prompt is not in a good state at the moment.
Thankfully @armano2 is working on an update.
This has to wait till prompt has been improved.

@escapedcat escapedcat added bug and removed question labels Jan 13, 2021
@xiaomuzizier
Copy link
Author

@meteorlxy thanks you for helping me.

@xiaomuzizier
Copy link
Author

@escapedcat oh.thx.then i will wait.I will follow updates at any time.
Thankfully @armano2 is working on an update.

@escapedcat escapedcat changed the title How to not format How to not format [prompt] Jan 14, 2021
@xiaomuzizier
Copy link
Author

@escapedcat Is this bug solved?

@escapedcat
Copy link
Member

No, sorry. The MR #2375 is still open. But maybe we could try to rebase it to master and if it turns green we could merge it.
You wanna give it a try?

@xiaomuzizier
Copy link
Author

@escapedcat I'd like to try that. But I have little experience with open source projects, I don’t know if I can do it

@escapedcat
Copy link
Member

Ok, no worries. In this case it's a bit more complicated because the branch is in armanos fork. Let me try that and we'll see what happens. I'll let you know when I did it.

@xiaomuzizier
Copy link
Author

@escapedcat ok,thx!!Looking forward to co-developing the project with you next time

@armano2
Copy link
Contributor

armano2 commented Dec 7, 2021

@escapedcat this can be closed as for #2697

@escapedcat
Copy link
Member

Thanks @armano2 , closing

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

No branches or pull requests

4 participants