From 37a9a5cda31f3b97dc8a14da37e5a1dd6fa99e9c Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Sat, 7 May 2022 12:47:12 -0400 Subject: docs: New USAGE.md document --- README.md | 54 ++++++++++++++---------------------------------------- 1 file changed, 14 insertions(+), 40 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index 07c5c3b..4f49dac 100644 --- a/README.md +++ b/README.md @@ -12,9 +12,10 @@ [ **[Features](#features)** ]  [ **[Installation](#installation)** ]  -[ **[Changelog](/docs/CHANGELOG.md)** ]  +[ **[Usage](/docs/USAGE.md)** ]  [ **[Building](/docs/BUILDING.md)** ]  -[ **[Hacking](/docs/HACKING.md)** ] +[ **[Hacking](/docs/HACKING.md)** ]  +[ **[Changelog](/docs/CHANGELOG.md)** ] Screenshot

@@ -126,7 +127,7 @@ $ bfs -nam needle bfs: error: Unknown argument; did you mean -name? -`bfs` also includes a powerful static analysis to identify likely mistakes: +`bfs` also includes a powerful static analysis to help catch mistakes:
 $ bfs -print -name 'needle'
@@ -142,48 +143,21 @@ $ bfs -print -name 'needle'
 

-### `-exclude` +For example, the `-exclude` operator skips over entire subtrees whenever an expression matches. +`-exclude` is both more powerful and easier to use than the standard `-prune` action; compare -The `-exclude` operator skips an entire subtree whenever an expression matches. -For example, `-exclude -name .git` will exclude any files or directories named `.git` from the search results. -`-exclude` is easier to use than the standard `-prune` action; compare - - bfs -name config -exclude -name .git +
+$ bfs -name config -exclude -name .git
+
to the equivalent - find ! \( -name .git -prune \) -name config - -Unlike `-prune`, `-exclude` even works in combination with `-depth`/`-delete`. - ---- - -### `-hidden`/`-nohidden` - -`-hidden` matches "hidden" files (dotfiles). -`bfs -hidden` is effectively shorthand for - - find \( -name '.*' -not -name . -not -name .. \) - -`-nohidden` is equivalent to `-exclude -hidden`. - ---- - -### `-unique` - -This option ensures that `bfs` only visits each file once, even if it's reachable through multiple hard or symbolic links. -It's particularly useful when following symbolic links (`-L`). - ---- - -### `-color`/`-nocolor` - -When printing to a terminal, `bfs` automatically colors paths like GNU `ls`, according to the `LS_COLORS` environment variable. -The `-color` and `-nocolor` options override the automatic behavior, which may be handy when you want to preserve colors through a pipe: - - bfs -color | less -R +
+$ find ! \( -name .git -prune \) -name config
+
-If the [`NO_COLOR`](https://no-color.org/) environment variable is set, colors will be disabled by default. +As an additional shorthand, `-nohidden` skips over all hidden files and directories. +See the [usage documentation](/docs/USAGE.md#extensions) for more about the extensions provided by `bfs`. -- cgit v1.2.3