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

关于交互式建议 #58

Open
hb0730 opened this issue Jul 26, 2022 · 5 comments
Open

关于交互式建议 #58

hb0730 opened this issue Jul 26, 2022 · 5 comments
Assignees
Labels
enhancement New feature or request

Comments

@hb0730
Copy link
Contributor

hb0730 commented Jul 26, 2022

  1. interact.ReadLine 是否新增必填选项

  2. interact.SelectOne

     SelectOne(title string, options interface{}, defOpt string, allowQuit ...bool)

    既然默认值已经是string,那optionsinterface是否能够确认类型,
    好像defOpt只能是字符串下标

    image
    这种可能想要的只是bool

参考 promptui

@inhere
Copy link
Member

inhere commented Jul 26, 2022

原来实现的比较简单。一直也没时间进一步优化改进 :)

有兴趣可以参与改进下

@hb0730
Copy link
Contributor Author

hb0730 commented Jul 27, 2022

@inhere Command Cli时好像无法正确解析bool类型

1658899319246

image

image

@inhere inhere added the enhancement New feature or request label Jul 27, 2022
@inhere
Copy link
Member

inhere commented Jul 27, 2022

这是参照 go flag 的逻辑处理的。
bool 值一般不会主动通过输入设置false,因为默认就是false。
要设置只能 -f=false。 go flag 底层没改的话应该也是这样的

@hb0730
Copy link
Contributor Author

hb0730 commented Jul 27, 2022

@inhere 也试过 go flag方式init -f=false vue-test

会提示错误

ERROR: option error - bad flag syntax: -=

image

@inhere
Copy link
Member

inhere commented Jul 27, 2022

👍 哦 看到调试信息,好像知道哪里错误了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants