Skip to content

feat: --exclude-fromでexclude path listを読み込めるようにする #30

Description

@seekerkrt

Status

検討候補 / future candidate

現時点では実装順・release targetを確定しない。

Goal

repeatableな--exclude PATHを多数指定する用途向けに、exclude path listをfileから読み込む仕組みを検討する。

候補CLI:

dotdoc --exclude-from .dotdoc-exclude "$HOME"

Motivation

--excludeは明示的で小さなCLI contractとして扱いやすい一方、広いscan rootで除外対象が増えるとcommand lineが長くなる。

既存の--exclude semanticsを再利用し、fileは単にliteral path listを供給するだけの最小拡張を第一候補とする。

Preliminary semantics

  • file内は1行1pathを基本案とする
  • 各pathは既存--exclude PATHと同じくscan-root-relative
  • lexical normalization / absolute path rejection / root escape rejection等は既存--exclude contractを再利用する
  • directoryはsubtree prune、file / symlinkはexact skip
  • nonexistent exclude pathは既存contractどおりno-op
  • --exclude--exclude-fromは併用可能にする案を基本とする

Open questions

  • empty lineを無視するか
  • # comment syntaxを持つか、それともliteral-onlyに徹するか
  • duplicate pathの扱い
  • exclude file自体が存在しない / unreadable場合のerror contract
  • --exclude-fromをrepeatableにするか
  • stdin (--exclude-from -) をサポートするか

Important boundary

初期案ではgitignore互換機能にしない

以下は別の必要性が確認されるまで導入しない。

  • glob (*, **, ?)
  • regex
  • negation rule (!)
  • .gitignore parser
  • directoryごとのignore inheritance

目的は既存のliteral --exclude をfileへ退避できることに限定する。

Non-goals

  • .gitignore自動利用
  • built-in ignore list
  • generic config file
  • diagnostic kind別ignore
  • full ignore engine

Acceptance criteria candidate

  • fileから複数のexclude pathを読み込める
  • 各entryに既存--excludeと同じvalidation / normalization semanticsを適用する
  • excluded directory subtreeをtraversal時にpruneする
  • --excludeと併用できる
  • invalid / unreadable exclude fileは明確なerror / exit 2になる
  • glob / regex展開を行わない
  • stdout / stderr / exit status contractを維持する
  • --help / man / README EN・JAを必要に応じて更新する
  • integration testを追加しmake testが通る

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions