通过简单的投票机制,跨任意维度比较任意数量的任意项目。获取每个类别以及总票数最多的项目的报告。

1.0.5 2023-05-25 20:10 UTC

This package is auto-updated.

Last update: 2024-09-25 23:04:00 UTC


README

描述

Cream 是一个用 PHP 编写的命令行应用程序,它使用简单的投票机制来比较任意数量的项目在任意数量的维度上。它以表格格式返回结果报告,以便您可以查看每个维度以及总体的上升项。

安装

composer global require sleepingmonk/cream

确保您的全局 composer bin 目录已在您的路径中。

使用方法

Usage:
  bin/cream [options] [--] [<file>]

Arguments:
  file                  The file to cream.

Options:
  -r, --report          Show report for existing file.
  -h, --help            Display help for the given command. When no command is given display help for the bin/cream command
  -q, --quiet           Do not output any message
  -V, --version         Display this application version
      --ansi|--no-ansi  Force (or disable --no-ansi) ANSI output
  -n, --no-interaction  Do not ask any interactive question
  -v|vv|vvv, --verbose  Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

请只使用不带扩展名的文件名,Cream 将自动将 .json 添加到您输入的文件名。

如果您不输入文件名,Cream 将提示您输入一个。

如果您输入的文件名不存在,Cream 将在您运行命令的目录中创建它。

如果您输入的文件名已存在,Cream 将重复投票过程,项目将积累更多票数。因此,您可以通过多次运行同一文件来细化结果,在不同的情绪、不同的观点、在一定时间内,甚至与不同的人进行采样以达成共识。

过程

一旦您有了文件名,Cream 将提示您输入要比较的项目。您可以输入任意多个。完成后,什么也不输入。

Cream 然后将提示您输入用于比较项目的维度。您可以输入任意多个。完成后,什么也不输入。

Cream 然后将提示您为每个维度比较每个项目与其他每个项目。按 1 为左侧的项目投票或按 0 为右侧的项目投票。如果您输入了其他内容,Cream 将再次提示您。

完成后,Cream 将以表格格式显示结果。

示例

$ cream restaurants

Could not open file restaurants.json. Creating it.

0 items found in file. Please add at least 2 items.
Type an item for comparison: [enter to finish] kinjo

1 items found in file. Please add at least 1 items.
Type an item for comparison: [enter to finish] gojiro

2 items found in file. Please add at least 0 items.
Type an item for comparison: [enter to finish]

0 dimensions found in file. Please add at least 2 dimensions.
Type a dimension for comparison: [enter to finish] price

1 dimensions found in file. Please add at least 1 dimensions.
Type a dimension for comparison: [enter to finish] quality

2 dimensions found in file. Please add at least 0 dimensions.
Type a dimension for comparison: [enter to finish] service

3 dimensions found in file. Please add at least 0 dimensions.
Type a dimension for comparison: [enter to finish]

Creaming restaurants.json with dimensions: price,quality,service
Let's GO!

------------------ price ------------------

Dimension: price

1) kinjo vs 0) gojiro
Who wins? [1/0]
gojiro wins!

------------------ quality ------------------

Dimension: quality

1) kinjo vs 0) gojiro
Who wins? [1/0]
kinjo wins!

------------------ service ------------------

Dimension: service

1) kinjo vs 0) gojiro
Who wins? [1/0]
kinjo wins!


The cream has risen!

+--------+-------+---------+---------+-------+
| Item   | price | quality | service | Total |
+--------+-------+---------+---------+-------+
| gojiro | 1     | 0       | 0       | 1     |
| kinjo  | 0     | 1       | 1       | 2     |
+--------+-------+---------+---------+-------+