在我的情况下,我需要回答一些没有Y或N但有文字或空白的问题。 我发现在我的情况下执行此操作的最佳方法是创建一个shellscript文件。 在我的情况下,我称之为autocomplete.sh
我需要为一个学说模式导出器回答一些问题,所以我的文件看起来像这样。
- 这只是一个例子 -
php vendor/bin/mysql-workbench-schema-export mysqlworkbenchfile.mwb ./doctrine << EOF
`#Export to Doctrine Annotation Format` 1
`#Would you like to change the setup configuration before exporting` y
`#Log to console` y
`#Log file` testing.log
`#Filename [%entity%.%extension%]`
`#Indentation [4]`
`#Use tabs [no]`
`#Eol delimeter (win, unix) [win]`
`#Backup existing file [yes]`
`#Add generator info as comment [yes]`
`#Skip plural name checking [no]`
`#Use logged storage [no]`
`#Sort tables and views [yes]`
`#Export only table categorized []`
`#Enhance many to many detection [yes]`
`#Skip many to many tables [yes]`
`#Bundle namespace []`
`#Entity namespace []`
`#Repository namespace []`
`#Use automatic repository [yes]`
`#Skip column with relation [no]`
`#Related var name format [%name%%related%]`
`#Nullable attribute (auto, always) [auto]`
`#Generated value strategy (auto, identity, sequence, table, none) [auto]`
`#Default cascade (persist, remove, detach, merge, all, refresh, ) [no]`
`#Use annotation prefix [ORM\]`
`#Skip getter and setter [no]`
`#Generate entity serialization [yes]`
`#Generate extendable entity [no]` y
`#Quote identifier strategy (auto, always, none) [auto]`
`#Extends class []`
`#Property typehint [no]`
EOF
我喜欢这个策略的是你可以评论你的答案是什么,并使用EOF一个空行就是那个(默认答案)。 顺便说一下,这个导出工具有自己的JSON对应方式来回答这些问题,但是在我这样做之后我想出了这个=)。
运行脚本只需在您想要的目录中,并在终端中运行'sh autocomplete.sh'。
简而言之,通过将<< EOL和EOF与Return Lines结合使用,您可以根据需要回答每个提示问题。 每个新行都是一个新答案。
我的例子只是展示了如何使用`字符进行注释,以便你记住每个步骤是什么。
注意这种方法的另一个优点是你可以用更多的答案来回答Y或N ...实际上你可以用空白来回答!
希望这有助于某人。