You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The `anticipate` method can be used to provided autocompletion for possible choices. The user can still choose any answer, regardless of the choices.
233
+
`anticipate`方法用来为可能的选择做自动填充。用户仍然可以填任何答案而无视这些选项。
234
234
235
235
$name = $this->anticipate('What is your name?', ['Taylor', 'Dayle']);
236
236
237
-
If you need to give the user a predefined set of choices, you may use the `choice` method. The user chooses the index of the answer, but the value of the answer will be returned to you. You may set the default value to be returned if nothing is chosen:
$name = $this->choice('What is your name?', ['Taylor', 'Dayle'], false);
240
240
241
241
<aname="writing-output"></a>
242
-
### Writing Output
242
+
### 编写输出
243
243
244
-
To send output to the console, use the `info`,`comment`,`question` and `error` methods. Each of these methods will use the appropriate ANSI colors for their purpose.
To display an information message to the user, use the `info` method. Typically, this will display in the console as green text:
246
+
使用`info`方法来显示信息。一般情况下,在命令行中会显示为绿色文本:
247
247
248
248
/**
249
249
* Execute the console command.
@@ -255,11 +255,11 @@ To display an information message to the user, use the `info` method. Typically,
255
255
$this->info('Display this on the screen');
256
256
}
257
257
258
-
To display an error message, use the `error` method. Error message text is typically displayed in red:
258
+
使用`error`方法来显示错误信息。一般情况下,在命令行中会显示为红色文本:
259
259
260
260
$this->error('Something went wrong!');
261
261
262
-
#### Table Layouts
262
+
#### 表格布局
263
263
264
264
The `table` method makes it easy to correctly format multiple rows / columns of data. Just pass in the headers and rows to the method. The width and height will be dynamically calculated based on the given data:
0 commit comments