alio/cli-file-tree

使用 PHPSchool/CliMenu 实现的菜单界面的文件选择 CLI 工具。

v1.0.0 2019-10-26 19:24 UTC

This package is auto-updated.

Last update: 2024-09-20 08:41:08 UTC


README

Build Status Total Downloads contributions welcome HitCount License

Laravel CLI 工具,使用菜单界面和 PHP School / CliMenu 进行文件选择

安装

您可以通过 composer 安装此包

composer require alio/cli-file-tree

用法

此 Laravel CLI 工具基本上允许您使用具有导航功能的菜单界面在系统中选择文件夹或文件,并返回所选文件的路径。

您还可以使用 --filter 选项通过(多个)文件扩展名过滤文件。

php artisan clifiletree [--filter=?] [--fg=?] [--bg=?]

--filter : (optional) display only folders or certain file types by extensions. Use 'folder' to display folders only. Supports multiple file extension filters by seperating with comma (Ex: csv,xls)
  --fg : (optional) foreground color (def. green)
  --bg : (optional) background color (def. black)

(possible color values : black, red, green, yellow, blue, magenta, cyan, white)

以下是一个在项目中使用此库的示例(最佳用法是从自定义命令中调用它)

use Illuminate\Support\Facades\Artisan;
use Symfony\Component\Console\Output\BufferedOutput;

...

$output = new BufferedOutput;
Artisan::call('clifiletree', ['--filter' => 'csv'], $output);

$file = $output->fetch();

// do whatever you want with the $file

...

截图

测试

composer test

附加说明

此包需要启用 PHP posix 扩展,可能在 Windows Wamp/Xampp 环境中无法正常工作。正在调查与新 Windows Terminal 的兼容性。

变更日志

2019年10月25日 - v1.0.0 发布。

问题

如果您发现任何问题,请在问题部分报告。

贡献者

欢迎贡献和 PR!

许可

MIT 许可证 (MIT)。有关更多信息,请参阅 许可文件