Score
Gaming toolkit for tracking scores, rankings, challenges, leaderboards, and rewards from the command line. Log entries, review history, export data, and search across all records.
Overview
Score is a versatile CLI tool for game and competition tracking. Each command logs or retrieves entries with timestamps. Pass arguments to record new data, or run a command with no arguments to view recent entries. Built-in utilities provide statistics, data export, search, and health checks.
Commands
| Command | Description |
|---|
| INLINECODE0 | Log a roll entry, or view recent rolls |
| INLINECODE1 |
Log a score entry, or view recent scores |
|
score rank [input] | Log a rank entry, or view recent rankings |
|
score history [input] | Log a history note, or view recent history |
|
score stats [input] | Log a stats note, or view recent stats entries |
|
score challenge [input] | Log a challenge, or view recent challenges |
|
score create [input] | Log a creation event, or view recent creates |
|
score join [input] | Log a join event, or view recent joins |
|
score track [input] | Log a tracking entry, or view recent tracks |
|
score leaderboard [input] | Log a leaderboard entry, or view recent standings |
|
score reward [input] | Log a reward, or view recent rewards |
|
score reset [input] | Log a reset event, or view recent resets |
|
score stats | Show summary statistics across all log files |
|
score export <fmt> | Export all data (json, csv, or txt) |
|
score search <term> | Search all entries for a term |
|
score recent | Show last 20 lines of activity history |
|
score status | Health check (version, entries, disk usage, last activity) |
|
score help | Show usage help |
|
score version | Show version (v2.0.0) |
Data Storage
- - Location: INLINECODE19
- Per-command logs: Each command (roll, score, rank, etc.) writes to its own
<command>.log file - History:
history.log — timestamped action log recording every operation - Export:
export.<fmt> — generated export files (json, csv, txt) - Format:
YYYY-MM-DD HH:MM|value per line in each log file - All data is plain text. No database or cloud service.
Requirements
- - bash (with
set -euo pipefail) - Standard Unix utilities (
date, wc, du, tail, grep, cat, head) - No external dependencies or API keys
When to Use
- 1. Tracking game scores — Use
score score "Player1 25pts" to log scores during a game night or tournament - Running leaderboards — Use
score leaderboard "Player1 #1" to maintain standings, then score export csv for spreadsheets - Dice rolling & randomness — Log dice results with
score roll "d20: 17" for tabletop RPG sessions - Challenge tracking — Create and track challenges between players with INLINECODE36
- Data analysis & export — Use
score stats for summary counts, score search to find specific entries, and score export json for programmatic analysis
Examples
CODEBLOCK0
CODEBLOCK1
CODEBLOCK2
How It Works
Each domain command (roll, score, rank, challenge, etc.) has dual behavior:
- - With arguments: Appends a timestamped entry to
<command>.log and logs the action to INLINECODE41 - Without arguments: Displays the last 20 entries from that command's log file
The stats utility aggregates entry counts across all log files. The export command converts all logs into JSON, CSV, or plain text format. The search command performs case-insensitive grep across every log file.
Tips
- - Each command is its own namespace — you can track dozens of game types simultaneously
- Use
recent for a quick dashboard of the last 20 actions - Pipe
export json output to jq for advanced analysis - Override data directory:
export SCORE_DIR=... (set in your environment before sourcing)
Powered by BytesAgain | bytesagain.com | hello@bytesagain.com
计分
用于在命令行追踪分数、排名、挑战、排行榜和奖励的游戏工具包。记录条目、查看历史、导出数据,并在所有记录中进行搜索。
概述
Score 是一款用于游戏和比赛追踪的多功能 CLI 工具。每个命令都会记录或检索带有时间戳的条目。传入参数可记录新数据,无参数运行命令可查看最近条目。内置实用程序提供统计、数据导出、搜索和健康检查功能。
命令
| 命令 | 描述 |
|---|
| score roll [输入] | 记录投掷条目,或查看最近投掷 |
| score score [输入] |
记录分数条目,或查看最近分数 |
| score rank [输入] | 记录排名条目,或查看最近排名 |
| score history [输入] | 记录历史备注,或查看最近历史 |
| score stats [输入] | 记录统计备注,或查看最近统计条目 |
| score challenge [输入] | 记录挑战,或查看最近挑战 |
| score create [输入] | 记录创建事件,或查看最近创建 |
| score join [输入] | 记录加入事件,或查看最近加入 |
| score track [输入] | 记录追踪条目,或查看最近追踪 |
| score leaderboard [输入] | 记录排行榜条目,或查看最近排名 |
| score reward [输入] | 记录奖励,或查看最近奖励 |
| score reset [输入] | 记录重置事件,或查看最近重置 |
| score stats | 显示所有日志文件的汇总统计 |
| score export <格式> | 导出所有数据(json、csv 或 txt) |
| score search <词条> | 在所有条目中搜索词条 |
| score recent | 显示最近 20 行活动历史 |
| score status | 健康检查(版本、条目数、磁盘使用、最近活动) |
| score help | 显示使用帮助 |
| score version | 显示版本(v2.0.0) |
数据存储
- - 位置: ~/.local/share/score/
- 按命令日志: 每个命令(roll、score、rank 等)写入自己的 <命令>.log 文件
- 历史: history.log — 记录每次操作的时间戳动作日志
- 导出: export.<格式> — 生成的导出文件(json、csv、txt)
- 格式:每个日志文件中每行格式为 YYYY-MM-DD HH:MM|值
- 所有数据均为纯文本。无需数据库或云服务。
要求
- - bash(使用 set -euo pipefail)
- 标准 Unix 工具(date、wc、du、tail、grep、cat、head)
- 无需外部依赖或 API 密钥
使用场景
- 1. 追踪游戏分数 — 使用 score score 玩家1 25分 在游戏之夜或锦标赛期间记录分数
- 运行排行榜 — 使用 score leaderboard 玩家1 #1 维护排名,然后使用 score export csv 导出到电子表格
- 掷骰子与随机性 — 使用 score roll d20: 17 记录桌面角色扮演游戏中的骰子结果
- 挑战追踪 — 使用 score challenge 速通第3关 创建和追踪玩家间的挑战
- 数据分析与导出 — 使用 score stats 查看汇总计数,score search 查找特定条目,score export json 进行程序化分析
示例
bash
记录一次掷骰子
score roll d20: 自然17
输出:[Score] roll: d20: 自然17
已保存。投掷条目总数:1
记录游戏分数
score score Alice 2500分 第3轮
输出:[Score] score: Alice 2500分 第3轮
已保存。分数条目总数:1
更新排行榜
score leaderboard Alice #1, Bob #2, Charlie #3
bash
查看最近投掷(无参数 = 读取模式)
score roll
查看总体统计
score stats
输出:history: 5 条条目
roll: 3 条条目
总计:8 条条目
数据大小:4.0K
在所有条目中搜索
score search Alice
bash
导出所有数据为 JSON
score export json
输出:已导出至 ~/.local/share/score/export.json(245 字节)
导出为 CSV 用于电子表格
score export csv
检查系统健康状态
score status
输出:版本:v2.0.0,数据目录,条目数,磁盘使用,最近活动
查看最近活动
score recent
工作原理
每个领域命令(roll、score、rank、challenge 等)具有双重行为:
- - 带参数: 将带时间戳的条目追加到 <命令>.log,并将操作记录到 history.log
- 无参数: 显示该命令日志文件中最近 20 条条目
stats 实用程序汇总所有日志文件的条目计数。export 命令将所有日志转换为 JSON、CSV 或纯文本格式。search 命令在所有日志文件中执行不区分大小写的 grep 搜索。
提示
- - 每个命令都是独立的命名空间 — 可同时追踪数十种游戏类型
- 使用 recent 快速查看最近 20 个操作的面板
- 将 export json 输出通过管道传递给 jq 进行高级分析
- 覆盖数据目录:export SCORE_DIR=...(在引用前在环境中设置)
由 BytesAgain 提供支持 | bytesagain.com | hello@bytesagain.com