43081j / 43081j/standardglob

Path matching vs. FS matching (`**`)

オープン
#4 コメント 11 件 リアクション 1 件 担当者 0 名 GitHub で見る
essential decision
主要言語
言語のデータがありません
スター
4
フォーク
0
PR マージ指標
30日以内にマージされた PR はありません

説明

Some behaviors are different between implementations based on the purpose of the impl in question.

The best _(maybe only?)_ example for this is `**`.

If all we are trying to do is match paths against a pattern, `**` can mean `any string of characters, including none, including path separators`.

But some implementations can and do make it semantically different in a way that provides the user more control by making it mean `any number of path segments, that are not files`

This is something that can only be done when the implementation already knows whether the path in question points to a file or directory, and would slow down matching massively if the implementation had to check every time.

### Examples

- `src/**` -> `src/foo/bar/biz.txt`, `src/foo/bosh/`
- path matching would match any parts of either
- nushell returns `src/`, `src/foo/`, `src/foo/bosh`, `src/foo/bar/`
- `src/**/*` would make nushell also return the files in the dirs

## Decisions to make

- How should we handle the difference between Path and File System matching?
- Another "FS matching" spec, building on the base?
- Define that `**` MAY match directories only?
- Not a good idea, adds invisible uncertainty to what the spec means

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。