pbergman / whiptail
PHP 对 Linux 原生 whiptail (shell dialog) 的封装
1.0.0
2014-04-08 21:03 UTC
This package is auto-updated.
Last update: 2024-08-29 12:38:44 UTC
README
PHP 对 Linux whiptail 的命令行封装
安装
推荐的安装方式是通过 composer 进行。
{
"require": {
"pbergman/whiptail": "@stable"
},
"repositories": [
{
"type": "vcs",
"url": "git@github.com:pbergman/whiptail.git"
}
],
"minimum-stability": "dev"
}
使用方法
use WhipTail\Controller as WhipTail; if (WhipTail::isAvailable()) { $whipTail = new WhipTail(); $whipTail ->setOption($whipTail::OPTION_PASSWORD_BOX) ->setBoxOption('title', 'Password') ->setMessage('new password'); $whipTail->run(); }
可用选项
OPTION_CHECK_LIST
OPTION_GAUGE
OPTION_INFO_BOX
OPTION_INPUT_BOX
OPTION_MENU
OPTION_MSG_BOX
OPTION_PASSWORD_BOX
OPTION_RADIO_LIST
OPTION_TEXT_BOX
OPTION_YES_NO
要查看所有选项的演示,请查看 Test.php。
窗口选项
可以通过 setBoxOption 方法设置窗口选项,第一个参数是选项名称,第二个参数是参数。
选项
clear clear screen on exit
defaultno default no button
default-item <string> set default string
fb use full buttons
nocancel no cancel button
yes-button <text> set text of yes button
no-button <text> set text of no button
ok-button <text> set text of ok button
cancel-button <text> set text of cancel button
noitem display tags only
separate-output output one line at a time
output-fd <fd> output to fd, not stdout
title <title> display title
backtitle <backtitle> display backtitle
scrolltext force vertical scrollbars
topleft put window in top-left corner