[Feature] Skip files without markers on --insert: --skip-no-markers
まだ誰も着手していません。
評価
調査の方向性
Start by reading internal/core/usecase/insertmd and the marker rule in replaceBetweenMarkers, then trace how CLI options reach the insert flow and how tests cover --insert and --stdout. Implementing this requires resolving the stated behavior questions about malformed marker pairs and whether the option implies --insert. Done means skipped files avoid API requests and changes, emit the specified warning, and preserve errors and exit codes for other failures.
索引モデルが issue の本文から書いたものです。
説明
Is your feature request related to a problem? Please describe.
--insert cannot run on all markdown files of a directory when only some of them have the
<!--ts--> and <!--te--> markers. Every file without the markers is an error, and the
run exits with 1. Here a.md and c.md have the markers, b.md does not:
$ gh-md-toc --insert --no-backup --hide-footer a.md b.md c.md
...
process "b.md": insert TOC into "b.md": no <!--ts--> / <!--te--> markers found
$ echo $?
1
a.md and c.md are updated, but the exit code fails a script or a CI step. The markers
are checked after the GitHub API request, so a request is spent for every such file too.
The same request for the Bash version is ekalinin/github-markdown-toc#110, and it is
implemented there in ekalinin/github-markdown-toc#199.
Describe the solution you'd like
The same option as in the Bash version: --skip-no-markers skips a local file without the
markers, so this works:
find . -name '*.md' -exec gh-md-toc --insert --no-backup --hide-footer --skip-no-markers {} +
Behavior in the Bash version:
- A skipped file is not changed, no backup is created for it, no request is sent to the
GitHub API for it, and stdout has no TOC entries of it. - stderr gets
<input>: Warning: no <!--ts--> or <!--te--> in the file, skipped, where
<input>is the input as given on the command line, also with one input. - The exit code is 0 when files are only skipped. An error of another input, such as a
GitHub API error, still exits with 1. - A local input that does not exist is not skipped: it is an error as before.
--skip-no-markersturns on--insert, as--no-backupand--hide-footerdo there.--skip-no-markerswith--stdout(#95) is an error before any network call.
Additional context
- The markers are checked in
internal/core/usecase/insertmdafterinner.DoAs, that is
after the API request. The check for this option has to run before it, with the same
marker rule asreplaceBetweenMarkers. - Differences from the Bash version to decide on:
- Here
--no-backuprequires--insertinstead of turning it on.--skip-no-markers
could follow the same rule. - Here a file with several marker pairs, or with
<!--te-->before<!--ts-->, is an
error too. Should it be skipped as well, or stay an error?
- Here
- 主要言語
- Go
- スター
- 525
- フォーク
- 89
- 平均マージ
- 6分
- マージ済み PR(30日)
- 1
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートなし
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
ekalinin/github-markdown-toc.go のほかの issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 80/100
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
-
enhancement
難易度 3/5 1〜2日 初心者へのやさしさ 65/100
-
enhancement
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
ekalinin/github-markdown-toc.go の issue をすべて見る
似ている issue
-
/shutdown/ready can fail to return an HTTP response when readiness takes longer than the server write timeout対応中かも @floriankoch が今日担当しました。 オープンtriage
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
envoyproxy/gateway#10562 ·
メンテナーはふだん 1 日以内に返信
-
Adding an LDAP group reports every search failure as "LDAP Group DN is not found"対応中かも @Daksha1611 が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
[Bug] K8s reconcile still resets explicit 0 to defaults for response_api, memory and flow state対応中かも @Bevisy が今日担当しました。 オープンneeds-acceptance
難易度 2/5 1〜3時間 初心者へのやさしさ 87/100
vllm-project/semantic-router#5998 ·
メンテナーはふだん 2 日以内に返信