[FEATURE] Add --help / -h flag (currently exits with File not found)

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

还没有人认领这个 Issue。

评估

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

调研方向

从 maithili_dsl/cli.py 中的 main() 开始,复制现有的 -V / --version 分支,以便在文件路径被当作文件名处理之前处理 -h 和 --help。先运行 python_maithili --help,查看当前退出码为 3 'File not found' 的行为。当两个标志都以退出码 0 退出,并以 Maithili 和英文打印用法,列出调用形式、标志和退出码,且 tests/test_cli.py 中有覆盖两个标志的测试时,即为完成。按 issue 的要求,在讨论之前不要切换到 argparse。

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

描述

area:cli enhancement good first issue P3

python_maithili --help currently prints Error: File '--help' not found. and exits 3 (verified) — there is no help flag at all.

Fix: in maithili_dsl/cli.py main(), handle -h / --help before the file path (same pattern as the existing -V / --version branch). Print usage in both Maithili and English, listing:

  • invocation forms (python_maithili <file.dmai>, python -m maithili_dsl <file.dmai>)
  • available flags (--version, --help, plus any added by other issues)
  • the documented exit codes (EXIT_OK 0, usage 2, not-found 3, lint 4, import-blocked 5, runtime 6)

Tests: tests/test_cli.py — --help and -h return exit 0 and contain the usage string.

Good first issue: pure CLI plumbing, no transpiler knowledge needed. (If you prefer migrating the hand-rolled arg handling to argparse, propose it in a comment first — it touches --version behavior too.)

主要语言
Python
星标
1
派生
4
平均合并
12 天 21 小时
30 天内合并 PR
1

环境准备

从这里开始

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

alphacrack/python-maithili-dsl 的其他 Issue

查看 alphacrack/python-maithili-dsl 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

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