Skip to content

Commit b5c639a

Browse files
authored
category flag for convert command (#927)
* Add category flag to convert command for cli. * Update changelog.
1 parent dc8b301 commit b5c639a

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

webknossos/Changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ For upgrade instructions, please check the respective _Breaking Changes_ section
1717
### Added
1818

1919
### Changed
20+
- The `convert` command of the cli now has a `--category` flag, to select the LayerCategoryType.
2021

2122
### Fixed
2223

webknossos/webknossos/cli/_utils.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,18 @@ class DistributionStrategy(str, Enum):
2929
DEBUGS_SEQUENTIAL = "debug_sequential"
3030

3131

32+
class LayerCategory(str, Enum):
33+
"""Enum of available layer categories.
34+
35+
TODO pylint: disable=fixme
36+
- As soon as supported by typer this enum should be
37+
replaced with typing.Literal in type hint.
38+
"""
39+
40+
COLOR = "color"
41+
SEGMENTATION = "segmentation"
42+
43+
3244
class DataFormat(str, Enum):
3345
"""Enum of available data formats."""
3446

webknossos/webknossos/cli/convert.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from webknossos import DataFormat, Dataset
1111
from webknossos.cli._utils import (
1212
DistributionStrategy,
13+
LayerCategory,
1314
VoxelSize,
1415
parse_path,
1516
parse_voxel_size,
@@ -44,6 +45,12 @@ def main(
4445
metavar="VOXEL_SIZE",
4546
),
4647
],
48+
category: Annotated[
49+
Optional[LayerCategory],
50+
typer.Option(
51+
help="The category of the layer that should be created.",
52+
),
53+
] = None,
4754
data_format: Annotated[
4855
DataFormat,
4956
typer.Option(
@@ -100,4 +107,5 @@ def main(
100107
data_format=data_format,
101108
executor=executor,
102109
compress=compress,
110+
layer_category=category.value if category else None,
103111
)

0 commit comments

Comments
 (0)