mirror of
https://github.com/onyx-and-iris/obsws-cli.git
synced 2025-07-18 02:41:47 +00:00
raise OBSWSCLIError
This commit is contained in:
parent
f0eb518609
commit
abbab5c746
@ -2,12 +2,14 @@
|
|||||||
|
|
||||||
from typing import Annotated
|
from typing import Annotated
|
||||||
|
|
||||||
from cyclopts import App, Argument, CycloptsError, Parameter
|
from cyclopts import App, Argument, Parameter
|
||||||
from rich.table import Table
|
from rich.table import Table
|
||||||
from rich.text import Text
|
from rich.text import Text
|
||||||
|
|
||||||
from . import console, util, validate
|
from . import console, util, validate
|
||||||
from .context import Context
|
from .context import Context
|
||||||
|
from .enum import ExitCode
|
||||||
|
from .error import OBSWSCLIError
|
||||||
|
|
||||||
app = App(name='scene')
|
app = App(name='scene')
|
||||||
|
|
||||||
@ -68,9 +70,9 @@ def current(
|
|||||||
):
|
):
|
||||||
"""Get the current program scene or preview scene."""
|
"""Get the current program scene or preview scene."""
|
||||||
if preview and not validate.studio_mode_enabled(ctx):
|
if preview and not validate.studio_mode_enabled(ctx):
|
||||||
raise CycloptsError(
|
raise OBSWSCLIError(
|
||||||
'Studio mode is not enabled, cannot get preview scene.',
|
'Studio mode is not enabled, cannot get preview scene.',
|
||||||
console=console.err,
|
code=ExitCode.INVALID_PARAMETER,
|
||||||
)
|
)
|
||||||
|
|
||||||
if preview:
|
if preview:
|
||||||
@ -98,15 +100,15 @@ def switch(
|
|||||||
):
|
):
|
||||||
"""Switch to a scene."""
|
"""Switch to a scene."""
|
||||||
if preview and not validate.studio_mode_enabled(ctx):
|
if preview and not validate.studio_mode_enabled(ctx):
|
||||||
raise CycloptsError(
|
raise OBSWSCLIError(
|
||||||
'Studio mode is not enabled, cannot set the preview scene.',
|
'Studio mode is not enabled, cannot switch to preview scene.',
|
||||||
console=console.err,
|
code=ExitCode.INVALID_PARAMETER,
|
||||||
)
|
)
|
||||||
|
|
||||||
if not validate.scene_in_scenes(ctx, scene_name):
|
if not validate.scene_in_scenes(ctx, scene_name):
|
||||||
raise CycloptsError(
|
raise OBSWSCLIError(
|
||||||
f'Scene [yellow]{scene_name}[/yellow] not found.',
|
f'Scene [yellow]{scene_name}[/yellow] not found.',
|
||||||
console=console.err,
|
code=ExitCode.NOT_FOUND,
|
||||||
)
|
)
|
||||||
|
|
||||||
if preview:
|
if preview:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user