-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update, merge master feature to php5 branch
- Loading branch information
Showing
105 changed files
with
4,475 additions
and
1,119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# php 命令行应用库 | ||
|
||
[简介和安装](intro.md) |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# 注册命令 | ||
|
||
### 注册独立命令 | ||
### 注册组命令 | ||
### 设置命令名称 | ||
### 设置命令描述 | ||
|
||
## 独立命令 | ||
|
||
## 组命令(controller) | ||
|
||
## 输入定义(InputDefinition) | ||
|
||
|
||
## 设置参数 | ||
|
||
### 使用名称设置参数 | ||
|
||
### 根据位置设置参数 | ||
|
||
``` | ||
$ php examples/app demo john male 43 --opt1 value1 -y | ||
hello, this in Inhere\Console\examples\DemoCommand::execute | ||
this is argument and option example: | ||
the opt1's value | ||
option: opt1 | | ||
| | | ||
php examples/app demo john male 43 --opt1 value1 -y | ||
| | | | | | | ||
script command | | |______ option: yes, it use shortcat: y, and it is a Input::OPT_BOOLEAN, so no value. | ||
| |___ | | ||
argument: name | argument: age | ||
argument: sex | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# input and output | ||
|
||
## input | ||
|
||
## output | ||
|
||
### output buffer | ||
|
||
how tu use | ||
|
||
- use `Output` | ||
|
||
```php | ||
// open buffer | ||
$this->output->startBuffer(); | ||
|
||
$this->output->write('message 0'); | ||
$this->output->write('message 1'); | ||
// .... | ||
$this->output->write('message n'); | ||
|
||
// stop and output buffer | ||
$this->output->stopBuffer(); | ||
``` | ||
|
||
- use `Show` | ||
|
||
```php | ||
// open buffer | ||
Show::startBuffer(); | ||
|
||
Show::write('message 0'); | ||
Show::write('message 1'); | ||
// .... | ||
Show::write('message n'); | ||
|
||
// stop and output buffer | ||
Show::stopBuffer(); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# 简介 | ||
|
||
简洁、功能全面的php命令行应用库。提供控制台参数解析, 颜色风格输出, 用户信息交互, 特殊格式信息显示。 | ||
|
||
> 无其他库依赖,可以方便的整合到任何已有项目中。 | ||
- 功能全面的命令行的选项参数解析(命名参数,短选项,长选项 ...) | ||
- 命令行应用, 命令行的 `controller`, `command` 解析运行 | ||
- 命令行中功能强大的 `input`, `output` 管理、使用 | ||
- 消息文本的多种颜色风格输出支持(`info`, `comment`, `success`, `danger`, `error` ... ...) | ||
- 丰富的特殊格式信息显示(`section`, `panel`, `padding`, `help-panel`, `table`, `title`, `list`, `progressBar`) | ||
- 常用的用户信息交互支持(`select`, `confirm`, `ask/question`) | ||
- 命令方法注释自动解析(提取为参数 `arguments` 和 选项 `options` 等信息) | ||
- 类似 `symfony/console` 的预定义参数定义支持(按位置赋予参数值) | ||
- 输出是 windows,linux 兼容的,不支持颜色的环境会自动去除相关CODE | ||
|
||
> 下面所有的特性,效果都是运行 `examples/` 中的示例代码 `php examples/app` 展示出来的。下载后可以直接测试体验 | ||
|
||
## 项目地址 | ||
|
||
- **github** https://github.com/inhere/php-console.git | ||
- **git@osc** https://git.oschina.net/inhere/php-console.git | ||
|
||
**注意:** | ||
|
||
- master 分支是要求 `php >= 7` 的(推荐使用)。 | ||
- php5 分支是支持 php5 `php >= 5.5` 的代码分支。 | ||
|
||
## 安装 | ||
|
||
- 使用 composer 命令 | ||
|
||
```bash | ||
composer require inhere/console | ||
``` | ||
|
||
- 使用 composer.json | ||
|
||
编辑 `composer.json`,在 `require` 添加 | ||
|
||
``` | ||
"inhere/console": "dev-master", | ||
// "inhere/console": "^2.0", // 指定稳定版本 | ||
// "inhere/console": "dev-php5", // for php5 | ||
``` | ||
|
||
然后执行: `composer update` | ||
|
||
- 直接拉取 | ||
|
||
``` | ||
git clone https://git.oschina.net/inhere/php-console.git // git@osc | ||
git clone https://github.com/inhere/php-console.git // github | ||
``` |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
Oops, something went wrong.