cmdlet refactor
This commit is contained in:
+23
-23
@@ -1,6 +1,6 @@
|
||||
# Tag Template Syntax
|
||||
|
||||
This guide documents the reusable template syntax for tag mutation commands such as `add-tag` and `delete-tag`.
|
||||
This guide documents the reusable template syntax for tag mutation commands such as `metadata -add` and `metadata -delete`.
|
||||
|
||||
The current goal is lowercase-first tagging. Examples in this document use lowercase tag names and lowercase text values, and no case-conversion transforms are part of the documented syntax.
|
||||
|
||||
@@ -8,8 +8,8 @@ The current goal is lowercase-first tagging. Examples in this document use lower
|
||||
|
||||
The shared template resolver currently applies to:
|
||||
|
||||
- `add-tag`
|
||||
- `delete-tag`
|
||||
- `metadata -add`
|
||||
- `metadata -delete`
|
||||
|
||||
Templates are resolved per item against that item's current tag set and lightweight result fields such as the current title.
|
||||
|
||||
@@ -20,9 +20,9 @@ Use `#(namespace)` to insert the value from an existing namespaced tag.
|
||||
Examples:
|
||||
|
||||
```powershell
|
||||
add-tag "title:#(track) - #(series)"
|
||||
add-tag "album:#(series)"
|
||||
delete-tag "title:#(track) - #(series)"
|
||||
metadata -add "title:#(track) - #(series)"
|
||||
metadata -add "album:#(series)"
|
||||
metadata -delete "title:#(track) - #(series)"
|
||||
```
|
||||
|
||||
If an item has:
|
||||
@@ -53,8 +53,8 @@ title:9 - ancient greek intensive course
|
||||
Examples:
|
||||
|
||||
```powershell
|
||||
add-tag "title:#(track #) - #(series)"
|
||||
add-tag "code:#(disc number)"
|
||||
metadata -add "title:#(track #) - #(series)"
|
||||
metadata -add "code:#(disc number)"
|
||||
```
|
||||
|
||||
## Transform Syntax
|
||||
@@ -74,9 +74,9 @@ Use `padding`, `pad`, or `zfill` to zero-pad a value.
|
||||
Examples:
|
||||
|
||||
```powershell
|
||||
add-tag "code:e<padding(00,#(episode))>"
|
||||
add-tag "code:e<pad(2,#(episode))>"
|
||||
add-tag "code:e<zfill(2,#(episode))>"
|
||||
metadata -add "code:e<padding(00,#(episode))>"
|
||||
metadata -add "code:e<pad(2,#(episode))>"
|
||||
metadata -add "code:e<zfill(2,#(episode))>"
|
||||
```
|
||||
|
||||
If `episode:3` exists, each example resolves to:
|
||||
@@ -99,8 +99,8 @@ Use `default(value,fallback)` when a namespace may be missing.
|
||||
Examples:
|
||||
|
||||
```powershell
|
||||
add-tag "season:<default(#(season),0)>"
|
||||
add-tag "disc:<default(#(disc),1)>"
|
||||
metadata -add "season:<default(#(season),0)>"
|
||||
metadata -add "disc:<default(#(disc),1)>"
|
||||
```
|
||||
|
||||
If `season:` is missing, the first example resolves to:
|
||||
@@ -116,8 +116,8 @@ Use `replace(value,old,new)` for simple substring replacement.
|
||||
Examples:
|
||||
|
||||
```powershell
|
||||
add-tag "slug:<replace(#(title),' ',_)>"
|
||||
add-tag "slug:<replace(#(series),-,_)>"
|
||||
metadata -add "slug:<replace(#(title),' ',_)>"
|
||||
metadata -add "slug:<replace(#(series),-,_)>"
|
||||
```
|
||||
|
||||
If `title:ancient greek intensive course` exists, the first example resolves to:
|
||||
@@ -135,8 +135,8 @@ Use `increment(value,amount)` to do small integer adjustments.
|
||||
Examples:
|
||||
|
||||
```powershell
|
||||
add-tag "episode_next:<increment(#(episode),1)>"
|
||||
add-tag "disc_next:<increment(#(disc),1)>"
|
||||
metadata -add "episode_next:<increment(#(episode),1)>"
|
||||
metadata -add "disc_next:<increment(#(disc),1)>"
|
||||
```
|
||||
|
||||
If `episode:3` exists, the first example resolves to:
|
||||
@@ -154,7 +154,7 @@ Tag arguments still support comma-separated tags, but commas inside transform ca
|
||||
This means the following stays as two tags, not three fragments:
|
||||
|
||||
```powershell
|
||||
add-tag "code:e<padding(00,#(episode))>,title:#(series)"
|
||||
metadata -add "code:e<padding(00,#(episode))>,title:#(series)"
|
||||
```
|
||||
|
||||
## Combining With `-extract`
|
||||
@@ -164,7 +164,7 @@ Templates are especially useful after deriving tags from a title.
|
||||
Example:
|
||||
|
||||
```powershell
|
||||
add-tag -extract "(series) - part (track)" "title:#(track) - #(series)"
|
||||
metadata -add -extract "(series) - part (track)" "title:#(track) - #(series)"
|
||||
```
|
||||
|
||||
For a title like:
|
||||
@@ -197,25 +197,25 @@ The command logs a warning summary for skipped unresolved templates.
|
||||
Episode-style numbering:
|
||||
|
||||
```powershell
|
||||
add-tag "code:e<padding(00,#(episode))>"
|
||||
metadata -add "code:e<padding(00,#(episode))>"
|
||||
```
|
||||
|
||||
Title synthesis from extracted tags:
|
||||
|
||||
```powershell
|
||||
add-tag -extract "(series) - part (track)" "title:#(track) - #(series)"
|
||||
metadata -add -extract "(series) - part (track)" "title:#(track) - #(series)"
|
||||
```
|
||||
|
||||
Delete a derived title tag:
|
||||
|
||||
```powershell
|
||||
delete-tag "title:#(track) - #(series)"
|
||||
metadata -delete "title:#(track) - #(series)"
|
||||
```
|
||||
|
||||
Reuse an existing value under a new namespace:
|
||||
|
||||
```powershell
|
||||
add-tag "album:#(series)"
|
||||
metadata -add "album:#(series)"
|
||||
```
|
||||
|
||||
## Mass Tagging Recipes
|
||||
|
||||
Reference in New Issue
Block a user