regression: CLI processing of globs

未关闭
#300 0 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
48/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
typescript
领域
cli, testing

调研方向

从 bin/httpsnippet 中的 CLI 入口点开始,使用 glob 命令针对 src/fixtures/requests/*.json 重现失败。跟踪参数的解析方式以及单个输入的处理方式,然后添加涵盖多个 glob 文件的 CLI 测试,并验证每个输入都会产生输出,而不是出现 unknown-arguments 错误。

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

描述

bug

The prior version of HTTPSnippet allowed processing of globs on the CLI as follows:

httpsnippet ./*.json --target node --client request --output ./snippets
$ tree snippets/
snippets/
├── endpoint-1.js
├── endpoint-2.js
└── endpoint-3.js

I wasn't aware of this prior functionality (and there were no tests covering it) so it was missed.

Shouldn't be too terrible to add back. Let's have some tests for it this time, too.

Reproduction steps

run the following:

./bin/httpsnippet src/fixtures/requests/*.json --target node --client unirest --output ./example

And it returns this input:

Unknown arguments: src/fixtures/requests/application-json.json, src/fixtures/requests/cookies.json, src/fixtures/requests/custom-method.json, src/fixtures/requests/full.json, src/fixtures/requests/headers.json, src/fixtures/requests/https.json, src/fixtures/requests/jsonObj-multiline.json, src/fixtures/requests/jsonObj-null-value.json, src/fixtures/requests/multipart-data.json, src/fixtures/requests/multipart-file.json, src/fixtures/requests/multipart-form-data.json, src/fixtures/requests/multipart-form-data-no-params.json, src/fixtures/requests/nested.json, src/fixtures/requests/query.json, src/fixtures/requests/short.json, src/fixtures/requests/text-plain.json

When it should, instead, process all of those files.

主要语言
TypeScript
星标
1.2k
派生
242
PR 合并指标
30 天内没有已合并 PR

贡献指南

打开贡献指南

从这里开始

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

Kong/httpsnippet 的其他 Issue

查看 Kong/httpsnippet 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

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