refactor
This commit is contained in:
parent
e30575a5ee
commit
8bc0b6a51b
4 changed files with 73 additions and 20 deletions
|
@ -4,20 +4,38 @@ os: linux
|
|||
repo: https://github.com/sharkdp/fd
|
||||
---
|
||||
# fd
|
||||
#refactor
|
||||
`fd` is a program to find entries in your filesystem. It is a simple, fast and user-friendly alternative to [`find`](https://www.gnu.org/software/findutils/). While it does not aim to support all of `find`'s powerful functionality, it provides sensible (opinionated) defaults for a majority of use cases.
|
||||
|
||||
## Usage
|
||||
Flags:
|
||||
```shell
|
||||
-H, --hidden Include hidden files
|
||||
-d, --max-depth <depth> Limit recursion
|
||||
-e, --extension <ext> Search by extension
|
||||
-x, --exec <cmd>... Execute command for every search result.
|
||||
The following placeholders are substituted before the command is executed:
|
||||
'{}': path (of the current search result)
|
||||
'{/}': basename
|
||||
'{//}': parent directory
|
||||
'{.}': path without file extension
|
||||
'{/.}': basename without file extension
|
||||
```
|
||||
Usage: `fd [OPTIONS] [pattern] [path]...`
|
||||
|
||||
### Options
|
||||
| Option | Description |
|
||||
| ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `-H, --hidden` | Include hidden directories and files in the search results |
|
||||
| `-I, --no-ignore` | Show search results from files and directories that would otherwise be ignored by `.gitignore`, `.ignore`, `.fdignore` |
|
||||
| `-u, --unrestricted` | Perform an unrestricted search, including ignored and hidden files. This is an alias for `--no-ignore --hidden`. |
|
||||
| `-s, --case-sensitive` | Perform a case-sensitive search. By default, fd uses case-insensitive searches, unless the pattern contains an uppercase character (smart case). |
|
||||
| `-i, --ignore-case` | Perform a case-insensitive search. By default, fd uses case-insensitive searches, unless the pattern contains an uppercase character (smart case). |
|
||||
| `-l, --list-details` | Use a detailed listing format like `ls -l`. This is basically an alias for `--exec-batch ls -l` with some additional `ls` options. This can be used to see more metadata, to show symlink targets and to achieve a deterministic sort order. |
|
||||
| `-L, --follow` | By default, fd does not descend into symlinked directories. Using this flag, symbolic links are also traversed. Flag can be overriden with `--no-follow`. |
|
||||
| `-0, --print0` | Separate search results by the null character (instead of newlines). Useful for piping results to `xargs`. |
|
||||
| `-d, --max-depth <depth>` | Limit the directory traversal to a given depth. By default, there is no limit on the search depth. |
|
||||
| `--min-depth <depth>` | Only show search results starting at the given depth. |
|
||||
| `--exact-depth <depth>` | Only show search results at the exact given depth. This is an alias for `--min-depth <depth> --max-depth <depth>`. |
|
||||
| `-E, --exclude <pattern>` | Exclude files/directories that match the given glob pattern. This overrides any other ignore logic. Multiple exclude patterns can be specified. |
|
||||
| `-t, --type <filetype>` | Filter the search by type:<br>- `f` or `file`: regular files<br>- `d` or `directory`: directories<br>- `l` or `symlink`: symbolic links<br>- `s` or `socket`: socket<br>- `p` or `pipe`: named pipe (FIFO)<br>- `x` or `executable`: executables<br>- `e` or `empty`: empty files or directories<br><br>This option can be specified more than once to include multiple file types. |
|
||||
| `-e, --extension <ext>` | (Additionally) filter search results by their file extension. Multiple allowable file extensions can be specified. |
|
||||
| `-S, --size <size>` | Limit results based on the size of files using the format `<+-><NUM><UNIT>`.<br>- `+`: file size must be greater than or equal to this<br>- `-`: file size must be less than or equal to this<br>If neither `+` nor `-` is specified, file size must be exactly equal to this. |
|
||||
| `--changed-within <date/dur>` | Filter results based on the file modification time. Files with modification times greater than the argument are returned. The argument can be provided as a specific point in time (`YYYY-MM-DD HH:MM:SS`) or as a duration (`10h`, `1d`, `35min`). If the time is not specified, it defaults to `00:00:00`. `--change-newer-than`, `--newer`, or `--changed-after` can be used as aliases.<br><br>Examples:<br>- `--changed-within 2weeks`<br>- `--change-newer-than '2018-10-27 10:00:00'`<br>- `--newer 2018-10-27`<br>- `--changed-after 1day` |
|
||||
| `--changed-before <date/dur>` | Filter results based on the file modification time. Files with modification times less than the argument are returned. |
|
||||
| `-o, --owner <user:group>` | Filter files by their user and/or group. Format: `[(user/uid)][:(group/gid)]`. Either side is optional. Precede either side with a `!` to exclude files instead.<br><br>Examples:<br>- `--owner john`<br>- `--owner :students`<br>- `--owner '!john:students'` |
|
||||
| `-x, --exec <cmd>...` | Execute a command for each search result in parallel (use `--threads=1` for sequential command execution). All positional arguments following `--exec` are considered to be arguments to the command - not to fd. It is therefore recommended to place the `-x`/`--exec` option last.<br><br>The following placeholders are substituted before the command is executed:<br>- `{}`: path (of the current search result)<br>- `{/}`: basename<br>- `{//}`: parent directory<br>- `{.}`: path without file extension<br>- `{/.}`: basename without file extension<br><br>If no placeholder is present, an implicit `{}` at the end is assumed. |
|
||||
| `-X, --exec-batch <cmd>...` | Execute the given command once, with all search results as arguments. One of the following placeholders is substituted before the command is executed:<br><br>- `{}`: path (of all search results)<br>- `{/}`: basename<br>- `{//}`: parent directory<br>- `{.}`: path without file extension<br>- `{/.}`: basename without file extension<br><br>If no placeholder is present, an implicit `{}` at the end is assumed. |
|
||||
| `--batch-size <size>` | Maximum number of arguments to pass to the command given with `-X`. If the number of results is greater than the given size, the command given with `-X` is run again with remaining arguments. A batch size of zero means there is no limit (default), but note that batching might still happen due to OS restrictions on the maximum length of command lines. |
|
||||
| `--ignore-file <path>` | Add a custom ignore-file in `.gitignore` format. These files have a low precedence. |
|
||||
| `-j, --threads <num>` | Set number of threads to use for searching & executing (default: number of available CPU cores) |
|
||||
| `--max-results <count>` | Limit the number of search results to `count` and quit immediately. |
|
||||
| `-1` | Limit the search to a single result and quit immediately. This is an alias for `--max-results=1`. |
|
||||
| `-q, --quiet` | When the flag is present, the program does not print anything and will return with an exit code of 0 if there is at least one match. Otherwise, the exit code will be 1. |
|
||||
| `--one-file-system` | By default, fd will traverse the file system tree as far as other options dictate. With this flag, fd ensures that it does not descend into a different file system than the one it started in. |
|
||||
|
|
|
@ -4,7 +4,43 @@ os:
|
|||
- linux
|
||||
repo: https://github.com/BurntSushi/ripgrep
|
||||
---
|
||||
|
||||
# ripgrep
|
||||
#refactor
|
||||
[Repo](https://github.com/BurntSushi/ripgrep)
|
||||
ripgrep is a line-oriented search tool that recursively searches the current directory for a regex pattern. By default, ripgrep will respect gitignore rules and automatically skip hidden files/directories and binary files. ripgrep has first class support on Windows, [macOS](../../macos/macOS.md) and [Linux](../../linux/Linux.md) with binary downloads available for [every release](https://github.com/BurntSushi/ripgrep/releases). ripgrep is similar to other popular search tools like The Silver Searcher, ack and grep.
|
||||
ripgrep is a line-oriented search tool that recursively searches the current directory for a [regex](../../tools/Regex.md) pattern. By default, ripgrep will respect gitignore rules and automatically skip hidden files/directories and binary files. ripgrep has first class support on Windows, [macOS](../../macos/macOS.md) and [Linux](../../linux/Linux.md) with binary downloads available for [every release](https://github.com/BurntSushi/ripgrep/releases). ripgrep is similar to other popular search tools like The Silver Searcher, ack and grep.
|
||||
|
||||
## Usage
|
||||
```shell
|
||||
rg [OPTIONS] PATTERN [PATH ...]
|
||||
rg [OPTIONS] -e PATTERN ... [PATH ...]
|
||||
rg [OPTIONS] -f PATTERNFILE ... [PATH ...]
|
||||
```
|
||||
|
||||
### Options
|
||||
| Option | Description |
|
||||
| ------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `-e PATTERN, --regexp=PATTERN` | A pattern to search for. This option can be provided multiple times, where all patterns given are searched, in addition to any patterns provided by `-f/--file`. Lines matching at least one of the provided patterns are printed. |
|
||||
| `-f PATTERNFILE, --file=PATTERNFILE` | Search for patterns from the given file, with one pattern per line. When this flag is used multiple times or in combination with the `-e/--regexp` flag, then all patterns provided are searched. Empty pattern lines will match all input lines, and the newline is not counted as part of the pattern. |
|
||||
| `--pre=COMMAND` | For each input `PATH`, this flag causes ripgrep to search the standard output of `<COMMAND> <PATH>` instead of the contents of `PATH`. This option expects the `COMMAND` program to either be a path or to be available in your `$PATH`. |
|
||||
| `-z, --search-zip` | This flag instructs ripgrep to search in compressed files. |
|
||||
| `-s, --case-sensitive` | Execute the search case sensitively. This is the default mode. |
|
||||
| `-i, --ignore-case` | When this flag is provided, all patterns will be searched case insensitively. |
|
||||
| `-v, --invert-match` | This flag inverts matching. That is, instead of printing lines that match, ripgrep will print lines that don't match. |
|
||||
| `-x, --line-regexp` | When enabled, ripgrep will only show matches surrounded by line boundaries. This is equivalent to surrounding every pattern with `^` and `$`. In other words, this only prints lines where the entire line participates in a match. |
|
||||
| `-m NUM, --max-count=NUM` | Limit the number of matching lines per file searched to NUM. |
|
||||
| `-U, --multiline` | This flag enable searching across multiple lines. |
|
||||
| `-S, --smart-case` | This flag instructs ripgrep to searches case insensitively if the pattern is all lowercase. Otherwise, ripgrep will search case sensitively. |
|
||||
| `--stop-on-nonmatch` | Enabling this option will cause ripgrep to stop reading a file once it encounters a non-matching line after it has encountered a matching line. This is useful if it is expected that all matches in a given file will be on sequential lines, for example due to the lines being sorted. |
|
||||
| `-j NUM, --threads=NUM` | This flag sets the approximate number of threads to use. A value of 0 (which is the default) causes ripgrep to choose the thread count using heuristics. |
|
||||
| `-L, --follow` | This flag instructs ripgrep to follow symbolic links while traversing directories. This behavior is disabled by default.<br>This flag can be disabled with `--no-follow`. |
|
||||
| `-., --hidden` | Search hidden files and directories. By default, hidden files and directories are skipped. Note that if a hidden file or a directory is whitelisted in an ignore file, then it will be searched even if this flag isn't provided. Similarly if a hidden file or directory is given explicitly as an argumnet to ripgrep.<br>This flag can be disabled with `--no-hidden`. |
|
||||
| `-g GLOB, --glob=GLOB` | Include or exclude files and directories for searching that match the given glob. This always overrides any other ignore logic. Multiple glob flags may be used. Globbing rules match `.gitignore` globs. Precede a glob with a `!` to exclude it. If multiple globs match a file or directory, the glob given later in the command line takes precedence. |
|
||||
| `--ignore-file=PATH` | Specifies a path to one or more gitignore formatted rules files. These patterns are applied after the patterns found in `.gitignore`, `.rgignore` and `.ignore` are applied and are matched relative to the current working directory. Multiple additional ignore files can be specified by using this flag repeatedly. When specifying multiple ignore files, earlier files have lower precedence than later files. |
|
||||
| `-d NUM, --max-depth=NUM` | This flag limits the depth of directory traversal to NUM levels beyond the paths given. A value of 0 only searches the explicitly given paths themselves. |
|
||||
| `-A NUM, --after-context=NUM` | Show NUM lines after each match. |
|
||||
| `-B NUM, --before-context=NUM` | Show NUM lines before each match. |
|
||||
| `-C NUM, --context=NUM` | Show NUM lines before and after each match. This is equivalent to providing both the `-B/--before-context` and `-A/--after-context` flags with the same value. |
|
||||
| `-c, --count` | This flag suppresses normal output and shows the number of lines that match the given patterns for each file searched. Each file containing a match has its path and count printed on each line. |
|
||||
| `--count-matches` | This flag suppresses normal output and shows the number of individual matches of the given patterns for each file searched. Each file containing matches has its path and match count printed on each line. Note that this reports the total number of individual matches and not the number of lines that match. |
|
||||
| `-l, --files-with-matches` | Print only the paths with at least one match and suppress match contents. |
|
||||
| `--files-without-match` | Print the paths that contain zero matches and suppress match contents. |
|
||||
| `--json` | Enable printing results in a [JSON](../../files/JSON.md) Lines format. When this flag is provided, ripgrep will emit a sequence of messages, each encoded as a [JSON](../../files/JSON.md) object. |
|
||||
|
|
|
@ -4,11 +4,12 @@ obj: concept
|
|||
---
|
||||
|
||||
# JSON
|
||||
#refactor
|
||||
JSON (JavaScript Object Notation) is a lightweight data interchange format that is easy for humans to read and write and easy for machines to parse and generate. It is often used for exchanging data between a web server and a web application, as well as between different programming languages.
|
||||
|
||||
JSON is commonly used in web development to transfer data between a web server and a web application. For example, when a web application makes a request to a web server, the server might respond with a JSON object or array containing the requested data.
|
||||
|
||||
Some technologies have been built on top of JSON like [JWT](../internet/JWT.md), [JSONPatch](../tools/JSONPatch.md) or [JSON Schema](../tools/JSON%20Schema.md).
|
||||
|
||||
## JSON Syntax
|
||||
|
||||
JSON is built on two structures: objects and arrays. An object is an unordered set of key/value pairs, while an array is an ordered collection of values.
|
||||
|
|
|
@ -6,8 +6,6 @@ obj: application
|
|||
# GPG
|
||||
gpg is the OpenPGP part of the GNU Privacy Guard (GnuPG). It is a tool to provide digital encryption and signing services using the OpenPGP standard. gpg features complete key management and all the bells and whistles you would expect from a full OpenPGP implementation.
|
||||
|
||||
#refactor add options + refactor
|
||||
|
||||
## Commands
|
||||
|
||||
**Sign:**
|
||||
|
|
Loading…
Reference in a new issue