Skip to content

Commit 1c0b0fd

Browse files
committed
some file modify. new feature: output support buffer.
1 parent 376d634 commit 1c0b0fd

37 files changed

+312
-120
lines changed

docs/catelog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# php 命令行应用库
2+
3+
[简介和安装](intro.md)
File renamed without changes.

document.md renamed to docs/controller.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
2-
## 注册命令
1+
# 注册命令
32

43
### 注册独立命令
54
### 注册组命令

docs/input-output.md

Whitespace-only changes.

docs/intro.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# 简介
2+
3+
简洁、功能全面的php命令行应用库。提供控制台参数解析, 颜色风格输出, 用户信息交互, 特殊格式信息显示。
4+
5+
> 无其他库依赖,可以方便的整合到任何已有项目中。
6+
7+
- 功能全面的命令行的选项参数解析(命名参数,短选项,长选项 ...)
8+
- 命令行应用, 命令行的 `controller`, `command` 解析运行
9+
- 命令行中功能强大的 `input`, `output` 管理、使用
10+
- 消息文本的多种颜色风格输出支持(`info`, `comment`, `success`, `danger`, `error` ... ...)
11+
- 丰富的特殊格式信息显示(`section`, `panel`, `padding`, `help-panel`, `table`, `title`, `list`, `progressBar`)
12+
- 常用的用户信息交互支持(`select`, `confirm`, `ask/question`)
13+
- 命令方法注释自动解析(提取为参数 `arguments` 和 选项 `options` 等信息)
14+
- 类似 `symfony/console` 的预定义参数定义支持(按位置赋予参数值)
15+
- 输出是 windows,linux 兼容的,不支持颜色的环境会自动去除相关CODE
16+
17+
> 下面所有的特性,效果都是运行 `examples/` 中的示例代码 `php examples/app` 展示出来的。下载后可以直接测试体验
18+
19+
20+
## 项目地址
21+
22+
- **github** https://github.com/inhere/php-console.git
23+
- **git@osc** https://git.oschina.net/inhere/php-console.git
24+
25+
**注意:**
26+
27+
- master 分支是要求 `php >= 7` 的(推荐使用)。
28+
- php5 分支是支持 php5 `php >= 5.5` 的代码分支。
29+
30+
## 安装
31+
32+
- 使用 composer 命令
33+
34+
```bash
35+
composer require inhere/console
36+
```
37+
38+
- 使用 composer.json
39+
40+
编辑 `composer.json`,在 `require` 添加
41+
42+
```
43+
"inhere/console": "dev-master",
44+
45+
// "inhere/console": "^2.0", // 指定稳定版本
46+
// "inhere/console": "dev-php5", // for php5
47+
```
48+
49+
然后执行: `composer update`
50+
51+
- 直接拉取
52+
53+
```
54+
git clone https://git.oschina.net/inhere/php-console.git // git@osc
55+
git clone https://github.com/inhere/php-console.git // github
56+
```
File renamed without changes.
File renamed without changes.

examples/DemoCommand.php renamed to examples/Commands/DemoCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@
66
* Time: 18:58
77
*/
88

9-
namespace Inhere\Console\Examples;
9+
namespace Inhere\Console\Examples\Commands;
1010

1111
use Inhere\Console\Command;
1212
use Inhere\Console\IO\Input;
1313
use Inhere\Console\IO\Output;
1414

1515
/**
1616
* Class DemoCommand
17-
* @package app\console\commands
17+
* @package Inhere\Console\Examples\Commands
1818
*/
1919
class DemoCommand extends Command
2020
{

examples/TestCommand.php renamed to examples/Commands/TestCommand.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@
66
* Time: 18:58
77
*/
88

9-
namespace Inhere\Console\Examples;
9+
namespace Inhere\Console\Examples\Commands;
1010

1111
use Inhere\Console\Command;
1212

1313
/**
1414
* Class Test
15+
* @package Inhere\Console\Examples\Commands
1516
*/
1617
class TestCommand extends Command
1718
{
@@ -26,6 +27,8 @@ class TestCommand extends Command
2627
* @options
2728
* --long,-s option description 1
2829
* --opt option description 2
30+
* @param $input
31+
* @param $output
2932
*/
3033
public function execute($input, $output)
3134
{

examples/HomeController.php renamed to examples/Controllers/HomeController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace Inhere\Console\Examples;
3+
namespace Inhere\Console\Examples\Controllers;
44

55
use Inhere\Console\Controller;
66
use Inhere\Console\IO\Input;
@@ -13,7 +13,7 @@
1313
/**
1414
* default command controller. there are some command usage examples(1)
1515
* Class HomeController
16-
* @package Inhere\Console\examples
16+
* @package Inhere\Console\Examples\Controllers
1717
*/
1818
class HomeController extends Controller
1919
{

0 commit comments

Comments
 (0)