-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add beet.contrib.unknown_files
- Loading branch information
Showing
8 changed files
with
57 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
"""Plugin to load unknown files.""" | ||
|
||
|
||
__all__ = [ | ||
"UnknownAsset", | ||
"UnknownData", | ||
"unknown_files", | ||
] | ||
|
||
|
||
from typing import ClassVar, Tuple | ||
|
||
from beet import BinaryFile, Context | ||
|
||
|
||
class UnknownAsset(BinaryFile): | ||
"""Class representing an unknown file in resource packs.""" | ||
|
||
scope: ClassVar[Tuple[str, ...]] = () | ||
extension: ClassVar[str] = "" | ||
|
||
|
||
class UnknownData(BinaryFile): | ||
"""Class representing an unknown file in data packs.""" | ||
|
||
scope: ClassVar[Tuple[str, ...]] = () | ||
extension: ClassVar[str] = "" | ||
|
||
|
||
def beet_default(ctx: Context): | ||
ctx.require(unknown_files) | ||
|
||
|
||
def unknown_files(ctx: Context): | ||
"""Plugin to load unknown files.""" | ||
ctx.assets.extend_namespace.append(UnknownAsset) | ||
ctx.data.extend_namespace.append(UnknownData) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
out |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
require: | ||
- beet.contrib.unknown_files | ||
data_pack: | ||
load: "src" | ||
output: "out" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"hello": "world" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
foo |
1 change: 1 addition & 0 deletions
1
examples/nosnap_load_unknown/src/data/demo/functions/foo.mcfunction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
say bop |