定制 inanepain/cli 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

inanepain/cli

最新稳定版本:0.17.0

Composer 安装命令:

composer require inanepain/cli

包简介

Utilities to simplify working with the console.

README 文档

README

Table of Contents

icon inanepain/cli

Utilities to simplify working with the console.

Requirements

  • PHP >= 8.4

Suggested PHP extensions

  • mbstring - Used for calculating string widths.

1. Install

composer
composer require inanepain/cli

2. Function List

  • Inane\Cli\out($msg, …​)

  • Inane\Cli\out_padded($msg, …​)

  • Inane\Cli\err($msg, …​)

  • Inane\Cli\line($msg = '', …​)

  • Inane\Cli\input()

  • Inane\Cli\prompt($question, $default = false, $marker = ':')

  • Inane\Cli\choose($question, $choices = 'yn', $default = 'n')

  • Inane\Cli\menu($items, $default = false, $title = 'Choose an Item')

3. Progress Indicators

  • Inane\Cli\notify\Dots($msg, $dots = 3, $interval = 100)

  • Inane\Cli\notify\Spinner($msg, $interval = 100)

  • Inane\Cli\progress\Bar($msg, $total, $interval = 100)

4. Tabular Display

  • Inane\Cli\Table::__construct(array $headers = null, array $rows = null)

  • Inane\Cli\Table::setHeaders(array $headers)

  • Inane\Cli\Table::setRows(array $rows)

  • Inane\Cli\Table::setRenderer(cli\table\Renderer $renderer)

  • Inane\Cli\Table::addRow(array $row)

  • Inane\Cli\Table::sort($column)

  • Inane\Cli\Table::display()

The display function will detect if output is piped and, if it is, render a tab delimited table instead of the ASCII table rendered for visual display.

You can also explicitly set the renderer used by calling Inane\Cli\Table::setRenderer() and giving it an instance of one of the concrete Inane\Cli\table\Renderer classes.

5. TextTable Display

Alternative table display.

$tt = new \Inane\Cli\TextTable();
$tt->addHeader(['Name', 'Description']);
$tt->addRow(['TextTable', 'Alternative table display.']);
echo $tt->render();

6. Tree Display

  • Inane\Cli\Tree::__construct()

  • Inane\Cli\Tree::setData(array $data)

  • Inane\Cli\Tree::setRenderer(cli\tree\Renderer $renderer)

  • Inane\Cli\Tree::render()

  • Inane\Cli\Tree::display()

7. Argument Parser

Argument parsing uses a simple framework for taking a list of command line arguments, usually straight from $_SERVER['argv'], and parses the input against a set of defined rules.

Check examples/arguments.php for an example.

8. Usage

See examples/ directory for examples.

9. Todo

  • Expand this README

  • Add doc blocks to rest of code

统计信息

  • 总下载量: 22
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 3
  • 依赖项目数: 1
  • 推荐数: 1

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unlicense
  • 更新时间: 2022-07-20

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固