Reject conflicting CLI operation modes

未关闭 适合新手
#215 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
78/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
cli, go
领域
cli

调研方向

从 main.go 中的 flag 声明和模式选择 switch 开始,issue 中直接链接了这里。通过检查 switch 并使用如 -scrape -upload -map 这样的冲突组合来复现,无需执行真实请求。完成标准是:任何同时包含多个 -scrape、-parse 和 -upload 的命令,都会在开始任何工作之前打印清晰的提示并以非零状态退出,而单一模式命令和未指定模式时的帮助输出保持原有行为。

由索引模型根据 Issue 内容生成。

描述

Description

The CLI accepts multiple operation modes (-scrape, -parse, and -upload) at once. The switch in main.go silently chooses the first matching mode instead of reporting an invalid combination.

For example, -scrape -upload -map starts scraping even though the command requests both scraping and uploading.

Expected behavior:

  • Reject any combination containing more than one operation mode with a clear message explaining that only one mode may be selected.
  • Exit with a nonzero status before starting scraping, parsing, or uploading.
  • Preserve valid single-mode commands and the existing help behavior when no mode is supplied.
Steps To Reproduce
  1. Build the executable with make build (or build.bat build on Windows).
  2. Run:
    ./api-tools -scrape -upload -map
    
  3. Observe that the CLI selects scraping instead of rejecting the conflicting modes.

The same problem applies to -scrape -parse, -parse -upload, and all three mode flags together. The example above performs a real map scrape; inspecting the mode-selection switch also demonstrates the problem without making requests.

Additional Context

Flag declarations and mode-selection switch in main.go.

Environment
主要语言
Go
星标
12
派生
54
平均合并
14 天 1 小时
30 天内合并 PR
1

环境准备

  • 提供 Dockerfile 或 Docker Compose 文件
  • 有 Pull Request 模板
  • 没有贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

UTDNebula/api-tools 的其他 Issue

查看 UTDNebula/api-tools 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。