Skip to content

Commit c73b1ff

Browse files
authored
New release 0.1.6 (#3)
* Feature: Added watch option to exists commands
1 parent 4031bcc commit c73b1ff

File tree

11 files changed

+56
-9
lines changed

11 files changed

+56
-9
lines changed

.pylintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[MAIN]
2-
disable=missing-module-docstring, missing-class-docstring, missing-function-docstring
2+
disable=missing-module-docstring, missing-class-docstring, missing-function-docstring, too-many-arguments, too-many-positional-arguments
33
max-line-length=120

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## v0.1.6 - 2025-16-01
4+
5+
### Features
6+
7+
- New watch option for exists command, e.g: `cube exists <cube_name> --watch`
8+
39
## v0.1.5 - 2025-16-01
410

511
### Features

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,10 @@ tm1cli process dump <name> --folder <path> --format <json|yaml>
5252
tm1cli process load <name> --folder <path> --format <json|yaml>
5353

5454
tm1cli cube list
55-
tm1cli cube exists <cube_name>
55+
tm1cli cube exists <cube_name> --watch
5656

5757
tm1cli dimension list
58-
tm1cli dimension exists <dimension_name>
58+
tm1cli dimension exists <dimension_name> -w
5959

6060
tm1cli view list <cube_name>
6161
tm1cli view exists <cube_name> <view_name>

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "tm1cli"
3-
version = "0.1.5"
3+
version = "0.1.6"
44
description = "A command-line interface (CLI) tool for interacting with TM1 servers using TM1py."
55
authors = ["onefloid <onefloid@gmx.de>"]
66
license = "MIT License"

tm1cli/commands/cube.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
from rich import print # pylint: disable=redefined-builtin
55
from TM1py.Services import TM1Service
66

7-
from tm1cli.utils.cli_param import DATABASE_OPTION
7+
from tm1cli.utils.cli_param import DATABASE_OPTION, INTERVAL_OPTION, WATCH_OPTION
88
from tm1cli.utils.various import resolve_database
9+
from tm1cli.utils.watch import watch_option
910

1011
app = typer.Typer()
1112

@@ -34,10 +35,13 @@ def list_cube(
3435

3536

3637
@app.command()
38+
@watch_option
3739
def exists(
3840
ctx: typer.Context,
3941
cube_name: str,
4042
database: Annotated[str, DATABASE_OPTION] = None,
43+
watch: Annotated[bool, WATCH_OPTION] = False, # pylint: disable=unused-argument
44+
interval: Annotated[int, INTERVAL_OPTION] = 5, # pylint: disable=unused-argument
4145
):
4246
"""
4347
Check if cube exists

tm1cli/commands/dimension.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
from rich import print # pylint: disable=redefined-builtin
55
from TM1py.Services import TM1Service
66

7-
from tm1cli.utils.cli_param import DATABASE_OPTION
7+
from tm1cli.utils.cli_param import DATABASE_OPTION, INTERVAL_OPTION, WATCH_OPTION
88
from tm1cli.utils.various import resolve_database
9+
from tm1cli.utils.watch import watch_option
910

1011
app = typer.Typer()
1112

@@ -34,10 +35,13 @@ def list_dimension(
3435

3536

3637
@app.command()
38+
@watch_option
3739
def exists(
3840
ctx: typer.Context,
3941
dimension_name: str,
4042
database: Annotated[str, DATABASE_OPTION] = None,
43+
watch: Annotated[bool, WATCH_OPTION] = False, # pylint: disable=unused-argument
44+
interval: Annotated[int, INTERVAL_OPTION] = 5, # pylint: disable=unused-argument
4145
):
4246
"""
4347
Check if dimension exists

tm1cli/commands/process.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@
77
from TM1py.Services import TM1Service
88
from typing_extensions import Annotated
99

10-
from tm1cli.utils.cli_param import DATABASE_OPTION
10+
from tm1cli.utils.cli_param import DATABASE_OPTION, INTERVAL_OPTION, WATCH_OPTION
1111
from tm1cli.utils.tm1yaml import dump_process, load_process
1212
from tm1cli.utils.various import print_error_and_exit, resolve_database
13+
from tm1cli.utils.watch import watch_option
1314

1415
app = typer.Typer()
1516

@@ -38,10 +39,13 @@ def list_process(
3839

3940

4041
@app.command()
42+
@watch_option
4143
def exists(
4244
ctx: typer.Context,
4345
name: str,
4446
database: Annotated[str, DATABASE_OPTION] = None,
47+
watch: Annotated[bool, WATCH_OPTION] = False, # pylint: disable=unused-argument
48+
interval: Annotated[int, INTERVAL_OPTION] = 5, # pylint: disable=unused-argument
4549
):
4650
"""
4751
Shows if process exists

tm1cli/commands/subset.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
from rich import print # pylint: disable=redefined-builtin
55
from TM1py.Services import TM1Service
66

7-
from tm1cli.utils.cli_param import DATABASE_OPTION
7+
from tm1cli.utils.cli_param import DATABASE_OPTION, INTERVAL_OPTION, WATCH_OPTION
88
from tm1cli.utils.various import resolve_database
9+
from tm1cli.utils.watch import watch_option
910

1011
app = typer.Typer()
1112

@@ -28,6 +29,7 @@ def list_subset(
2829

2930

3031
@app.command()
32+
@watch_option
3133
def exists(
3234
ctx: typer.Context,
3335
dimension_name: str,
@@ -36,6 +38,8 @@ def exists(
3638
bool, typer.Option("-p", "--private", help="Flag to specify if view is private")
3739
] = False,
3840
database: Annotated[str, DATABASE_OPTION] = None,
41+
watch: Annotated[bool, WATCH_OPTION] = False, # pylint: disable=unused-argument
42+
interval: Annotated[int, INTERVAL_OPTION] = 5, # pylint: disable=unused-argument
3943
):
4044
"""
4145
Check if subset exists

tm1cli/commands/view.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
from rich import print # pylint: disable=redefined-builtin
55
from TM1py.Services import TM1Service
66

7-
from tm1cli.utils.cli_param import DATABASE_OPTION
7+
from tm1cli.utils.cli_param import DATABASE_OPTION, INTERVAL_OPTION, WATCH_OPTION
88
from tm1cli.utils.various import resolve_database
9+
from tm1cli.utils.watch import watch_option
910

1011
app = typer.Typer()
1112

@@ -27,6 +28,7 @@ def list_view(
2728

2829

2930
@app.command()
31+
@watch_option
3032
def exists(
3133
ctx: typer.Context,
3234
cube_name: str,
@@ -35,6 +37,8 @@ def exists(
3537
bool, typer.Option("-p", "--private", help="Flag to specify if view is private")
3638
] = False,
3739
database: Annotated[str, DATABASE_OPTION] = None,
40+
watch: Annotated[bool, WATCH_OPTION] = False, # pylint: disable=unused-argument
41+
interval: Annotated[int, INTERVAL_OPTION] = 5, # pylint: disable=unused-argument
3842
):
3943
"""
4044
Check if view exists

tm1cli/utils/cli_param.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
import typer
22

33
DATABASE_OPTION = typer.Option("--database", "-d", help="Specify the database to use")
4+
WATCH_OPTION = typer.Option(
5+
"--watch", "-w", help="Watch the command output periodically."
6+
)
7+
INTERVAL_OPTION = (
8+
typer.Option("--interval", help="Interval in seconds for the watch option."),
9+
)

0 commit comments

Comments
 (0)