mirror of
https://github.com/Garmelon/PFERD.git
synced 2023-12-21 10:23:01 +01:00
Reword -name->
and -name-re->
docs and remove -name-exact->
This commit is contained in:
parent
17207546e9
commit
2c72a9112c
34
CONFIG.md
34
CONFIG.md
@ -213,7 +213,7 @@ Each line has the format `SOURCE ARROW TARGET` where `TARGET` is optional.
|
|||||||
literal delimited by `"` or `'` (e. g. `"foo\" bar/baz"`). Python's string
|
literal delimited by `"` or `'` (e. g. `"foo\" bar/baz"`). Python's string
|
||||||
escape syntax is supported. Trailing slashes are ignored. `TARGET` can be
|
escape syntax is supported. Trailing slashes are ignored. `TARGET` can be
|
||||||
formatted like `SOURCE`, but it can also be a single exclamation mark without
|
formatted like `SOURCE`, but it can also be a single exclamation mark without
|
||||||
quotes (`!`). `ARROW` is one of `-->`, `-exact->`, `-name->`, `-re->` and
|
quotes (`!`). `ARROW` is one of `-->`, `-name->`, `-exact->`, `-re->` and
|
||||||
`-name-re->`
|
`-name-re->`
|
||||||
|
|
||||||
If a rule's target is `!`, this means that when the rule matches on a path, the
|
If a rule's target is `!`, this means that when the rule matches on a path, the
|
||||||
@ -230,11 +230,15 @@ well as all its contents.
|
|||||||
|
|
||||||
### The `-name->` arrow
|
### The `-name->` arrow
|
||||||
|
|
||||||
The `-name->` arrow works similar to the `-->` arrow, but pretends it is in the
|
The `-name->` arrow lets you rename files and directories by their name,
|
||||||
same directory as the file or directory it is applied to. For example, the rule
|
regardless of where they appear in the file tree. Because of this, its `SOURCE`
|
||||||
`bar -name-> baz` would convert `foo/bar` into `foo/baz` and `foo/bar/xyz` into
|
must not contain multiple path segments, only a single name. This restriction
|
||||||
`foo/baz/xyz`. The rule `foo --> !` would ignore all files and directories named
|
does not apply to its `TARGET`. The `-name->` arrow is not applied recursively
|
||||||
`foo` as well as their contents.
|
to its own output to prevent infinite loops.
|
||||||
|
|
||||||
|
For example, the rule `foo -name-> bar/baz` would convert `a/foo` into
|
||||||
|
`a/bar/baz` and `a/foo/b/c/foo` into `a/bar/baz/b/c/bar/baz`. The rule `foo
|
||||||
|
-name-> !` would ignore all directories and files named `foo`.
|
||||||
|
|
||||||
### The `-exact->` arrow
|
### The `-exact->` arrow
|
||||||
|
|
||||||
@ -244,14 +248,6 @@ but `foo/bar/xyz` would be unaffected. Also, `foo -exact-> !` would only ignore
|
|||||||
`foo`, but not its contents (if it has any). The examples below show why this is
|
`foo`, but not its contents (if it has any). The examples below show why this is
|
||||||
useful.
|
useful.
|
||||||
|
|
||||||
### The `-name-exact->` arrow
|
|
||||||
|
|
||||||
The `-name-exact->` arrow works similar to the `-exact->` arrow, but pretends it
|
|
||||||
is in the same directory as the file or directory it is applied to. For example,
|
|
||||||
the rule `bar -name-exact-> baz` would convert `foo/bar` into `foo/baz` but
|
|
||||||
`foo/bar/xyz` would be unaffected. The rule `foo --> !` would ignore only ignore
|
|
||||||
files and directories named `foo`, but not their contents.
|
|
||||||
|
|
||||||
### The `-re->` arrow
|
### The `-re->` arrow
|
||||||
|
|
||||||
The `-re->` arrow uses regular expressions. `SOURCE` is a regular expression
|
The `-re->` arrow uses regular expressions. `SOURCE` is a regular expression
|
||||||
@ -275,8 +271,14 @@ example `{g2.lower()}` or `{g3.replace(' ', '_')}`.
|
|||||||
|
|
||||||
### The `-name-re->` arrow
|
### The `-name-re->` arrow
|
||||||
|
|
||||||
The `-name-re>` arrow works similar to the `-re->` arrow, but pretends it is in
|
The `-name-re>` arrow is like a combination of the `-name->` and `-re->` arrows.
|
||||||
the same directory as the file or directory it is applied to.
|
Instead of the `SOURCE` being the name of a directory or file, it's a regex that
|
||||||
|
is matched against the names of directories and files. `TARGET` works like the
|
||||||
|
`-re->` arrow's target.
|
||||||
|
|
||||||
|
For example, the arrow `(.*)\.jpeg -name-re-> {g1}.jpg` will rename all `.jpeg`
|
||||||
|
extensions into `.jpg`. The arrow `\..+ -name-re-> !` will ignore all files and
|
||||||
|
directories starting with `.`.
|
||||||
|
|
||||||
### Example: Tutorials
|
### Example: Tutorials
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user