tlnt-cli 1.7.0__tar.gz → 1.8.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {tlnt_cli-1.7.0 → tlnt_cli-1.8.0}/PKG-INFO +5 -6
- {tlnt_cli-1.7.0 → tlnt_cli-1.8.0}/README.md +4 -5
- {tlnt_cli-1.7.0 → tlnt_cli-1.8.0}/pyproject.toml +2 -2
- {tlnt_cli-1.7.0 → tlnt_cli-1.8.0}/pyproject.toml.orig +2 -2
- tlnt_cli-1.8.0/src/tlnt/cli/commands/api.py +220 -0
- {tlnt_cli-1.7.0 → tlnt_cli-1.8.0}/src/tlnt/cli/main.py +33 -23
- tlnt_cli-1.8.0/src/tlnt/core/api_endpoints.py +517 -0
- {tlnt_cli-1.7.0 → tlnt_cli-1.8.0}/src/tlnt/core/client.py +69 -3
- {tlnt_cli-1.7.0 → tlnt_cli-1.8.0}/src/tlnt/core/mekari.py +37 -84
- tlnt_cli-1.8.0/src/tlnt/core/services/__init__.py +86 -0
- tlnt_cli-1.8.0/src/tlnt/core/services/api.py +138 -0
- {tlnt_cli-1.7.0 → tlnt_cli-1.8.0}/src/tlnt/core/services/attendance.py +8 -49
- tlnt_cli-1.7.0/src/tlnt/cli/commands/api.py +0 -44
- tlnt_cli-1.7.0/src/tlnt/core/services/__init__.py +0 -47
- tlnt_cli-1.7.0/src/tlnt/core/services/api.py +0 -85
- {tlnt_cli-1.7.0 → tlnt_cli-1.8.0}/LICENSE +0 -0
- {tlnt_cli-1.7.0 → tlnt_cli-1.8.0}/src/tlnt/__init__.py +0 -0
- {tlnt_cli-1.7.0 → tlnt_cli-1.8.0}/src/tlnt/__main__.py +0 -0
- {tlnt_cli-1.7.0 → tlnt_cli-1.8.0}/src/tlnt/browser/__init__.py +0 -0
- {tlnt_cli-1.7.0 → tlnt_cli-1.8.0}/src/tlnt/browser/login.py +0 -0
- {tlnt_cli-1.7.0 → tlnt_cli-1.8.0}/src/tlnt/browser/oauth.py +0 -0
- {tlnt_cli-1.7.0 → tlnt_cli-1.8.0}/src/tlnt/browser/scripted.py +0 -0
- {tlnt_cli-1.7.0 → tlnt_cli-1.8.0}/src/tlnt/cli/__init__.py +0 -0
- {tlnt_cli-1.7.0 → tlnt_cli-1.8.0}/src/tlnt/cli/approvals.py +0 -0
- {tlnt_cli-1.7.0 → tlnt_cli-1.8.0}/src/tlnt/cli/avatars.py +0 -0
- {tlnt_cli-1.7.0 → tlnt_cli-1.8.0}/src/tlnt/cli/commands/__init__.py +0 -0
- {tlnt_cli-1.7.0 → tlnt_cli-1.8.0}/src/tlnt/cli/commands/attendance.py +0 -0
- {tlnt_cli-1.7.0 → tlnt_cli-1.8.0}/src/tlnt/cli/commands/calendar.py +0 -0
- {tlnt_cli-1.7.0 → tlnt_cli-1.8.0}/src/tlnt/cli/commands/login.py +0 -0
- {tlnt_cli-1.7.0 → tlnt_cli-1.8.0}/src/tlnt/cli/commands/logout.py +0 -0
- {tlnt_cli-1.7.0 → tlnt_cli-1.8.0}/src/tlnt/cli/commands/notifications.py +0 -0
- {tlnt_cli-1.7.0 → tlnt_cli-1.8.0}/src/tlnt/cli/commands/overtime.py +0 -0
- {tlnt_cli-1.7.0 → tlnt_cli-1.8.0}/src/tlnt/cli/commands/payslip.py +0 -0
- {tlnt_cli-1.7.0 → tlnt_cli-1.8.0}/src/tlnt/cli/commands/profile.py +0 -0
- {tlnt_cli-1.7.0 → tlnt_cli-1.8.0}/src/tlnt/cli/commands/reimbursement.py +0 -0
- {tlnt_cli-1.7.0 → tlnt_cli-1.8.0}/src/tlnt/cli/commands/setup.py +0 -0
- {tlnt_cli-1.7.0 → tlnt_cli-1.8.0}/src/tlnt/cli/commands/status.py +0 -0
- {tlnt_cli-1.7.0 → tlnt_cli-1.8.0}/src/tlnt/cli/commands/timeoff.py +0 -0
- {tlnt_cli-1.7.0 → tlnt_cli-1.8.0}/src/tlnt/cli/commands/update.py +0 -0
- {tlnt_cli-1.7.0 → tlnt_cli-1.8.0}/src/tlnt/cli/commands/version.py +0 -0
- {tlnt_cli-1.7.0 → tlnt_cli-1.8.0}/src/tlnt/cli/options.py +0 -0
- {tlnt_cli-1.7.0 → tlnt_cli-1.8.0}/src/tlnt/cli/output.py +0 -0
- {tlnt_cli-1.7.0 → tlnt_cli-1.8.0}/src/tlnt/cli/prompts.py +0 -0
- {tlnt_cli-1.7.0 → tlnt_cli-1.8.0}/src/tlnt/core/__init__.py +0 -0
- {tlnt_cli-1.7.0 → tlnt_cli-1.8.0}/src/tlnt/core/config.py +0 -0
- {tlnt_cli-1.7.0 → tlnt_cli-1.8.0}/src/tlnt/core/curl.py +0 -0
- {tlnt_cli-1.7.0 → tlnt_cli-1.8.0}/src/tlnt/core/device.py +0 -0
- {tlnt_cli-1.7.0 → tlnt_cli-1.8.0}/src/tlnt/core/http_client.py +0 -0
- {tlnt_cli-1.7.0 → tlnt_cli-1.8.0}/src/tlnt/core/logs.py +0 -0
- {tlnt_cli-1.7.0 → tlnt_cli-1.8.0}/src/tlnt/core/models.py +0 -0
- {tlnt_cli-1.7.0 → tlnt_cli-1.8.0}/src/tlnt/core/play_store.py +0 -0
- {tlnt_cli-1.7.0 → tlnt_cli-1.8.0}/src/tlnt/core/services/calendar.py +0 -0
- {tlnt_cli-1.7.0 → tlnt_cli-1.8.0}/src/tlnt/core/services/device.py +0 -0
- {tlnt_cli-1.7.0 → tlnt_cli-1.8.0}/src/tlnt/core/services/login.py +0 -0
- {tlnt_cli-1.7.0 → tlnt_cli-1.8.0}/src/tlnt/core/services/logout.py +0 -0
- {tlnt_cli-1.7.0 → tlnt_cli-1.8.0}/src/tlnt/core/services/notifications.py +0 -0
- {tlnt_cli-1.7.0 → tlnt_cli-1.8.0}/src/tlnt/core/services/overtime.py +0 -0
- {tlnt_cli-1.7.0 → tlnt_cli-1.8.0}/src/tlnt/core/services/payslip.py +0 -0
- {tlnt_cli-1.7.0 → tlnt_cli-1.8.0}/src/tlnt/core/services/profile.py +0 -0
- {tlnt_cli-1.7.0 → tlnt_cli-1.8.0}/src/tlnt/core/services/setup.py +0 -0
- {tlnt_cli-1.7.0 → tlnt_cli-1.8.0}/src/tlnt/core/services/status.py +0 -0
- {tlnt_cli-1.7.0 → tlnt_cli-1.8.0}/src/tlnt/core/services/timeoff.py +0 -0
- {tlnt_cli-1.7.0 → tlnt_cli-1.8.0}/src/tlnt/core/session.py +0 -0
- {tlnt_cli-1.7.0 → tlnt_cli-1.8.0}/src/tlnt/core/user_agent.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: tlnt-cli
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.8.0
|
|
4
4
|
Summary: CLI wrapper for HRIS attendance and employment workflows.
|
|
5
5
|
Author: Fathiraz Arthuro
|
|
6
6
|
License-Expression: MIT
|
|
@@ -25,11 +25,10 @@ Description-Content-Type: text/markdown
|
|
|
25
25
|
`tlnt` is a Python CLI wrapper for Mekari Talenta employment data,
|
|
26
26
|
notifications, attendance summaries and previews, and human-confirmed attendance actions.
|
|
27
27
|
|
|
28
|
-
>
|
|
29
|
-
>
|
|
30
|
-
>
|
|
31
|
-
>
|
|
32
|
-
> disclaimer](docs/index.md#disclaimer) before using it.
|
|
28
|
+
> **Warning:** `tlnt` is an unofficial, independent research and educational
|
|
29
|
+
> project. It is not affiliated with Mekari or Talenta. Use it only when your
|
|
30
|
+
> account and the actions you perform are authorized. Read the [full bilingual
|
|
31
|
+
> disclaimer](https://tlnt-docs.vercel.app/#disclaimer) before using it.
|
|
33
32
|
|
|
34
33
|
## Install
|
|
35
34
|
|
|
@@ -8,11 +8,10 @@
|
|
|
8
8
|
`tlnt` is a Python CLI wrapper for Mekari Talenta employment data,
|
|
9
9
|
notifications, attendance summaries and previews, and human-confirmed attendance actions.
|
|
10
10
|
|
|
11
|
-
>
|
|
12
|
-
>
|
|
13
|
-
>
|
|
14
|
-
>
|
|
15
|
-
> disclaimer](docs/index.md#disclaimer) before using it.
|
|
11
|
+
> **Warning:** `tlnt` is an unofficial, independent research and educational
|
|
12
|
+
> project. It is not affiliated with Mekari or Talenta. Use it only when your
|
|
13
|
+
> account and the actions you perform are authorized. Read the [full bilingual
|
|
14
|
+
> disclaimer](https://tlnt-docs.vercel.app/#disclaimer) before using it.
|
|
16
15
|
|
|
17
16
|
## Install
|
|
18
17
|
|
|
@@ -4,7 +4,7 @@ build-backend = "uv_build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "tlnt-cli"
|
|
7
|
-
version = "1.
|
|
7
|
+
version = "1.8.0"
|
|
8
8
|
description = "CLI wrapper for HRIS attendance and employment workflows."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = "MIT"
|
|
@@ -30,7 +30,7 @@ tlnt = "tlnt.cli.main:main"
|
|
|
30
30
|
dev = ["pytest>=9,<10"]
|
|
31
31
|
docs = [
|
|
32
32
|
"mkdocs>=1.6,<2",
|
|
33
|
-
"mkdocs-shadcn>=0.
|
|
33
|
+
"mkdocs-shadcn>=0.12.2,<1",
|
|
34
34
|
]
|
|
35
35
|
|
|
36
36
|
[tool.uv.build-backend]
|
|
@@ -4,7 +4,7 @@ build-backend = "uv_build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "tlnt-cli"
|
|
7
|
-
version = "1.
|
|
7
|
+
version = "1.8.0"
|
|
8
8
|
description = "CLI wrapper for HRIS attendance and employment workflows."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = "MIT"
|
|
@@ -26,7 +26,7 @@ tlnt = "tlnt.cli.main:main"
|
|
|
26
26
|
|
|
27
27
|
[dependency-groups]
|
|
28
28
|
dev = ["pytest>=9,<10"]
|
|
29
|
-
docs = ["mkdocs>=1.6,<2", "mkdocs-shadcn>=0.
|
|
29
|
+
docs = ["mkdocs>=1.6,<2", "mkdocs-shadcn>=0.12.2,<1"]
|
|
30
30
|
|
|
31
31
|
[tool.uv.build-backend]
|
|
32
32
|
# Without this, uv would look for src/tlnt_cli; the import package is tlnt.
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import inspect
|
|
4
|
+
import json
|
|
5
|
+
import re
|
|
6
|
+
from collections.abc import Callable, Iterable, Mapping
|
|
7
|
+
from typing import Annotated, Any
|
|
8
|
+
|
|
9
|
+
import typer
|
|
10
|
+
from typer.models import CommandInfo
|
|
11
|
+
|
|
12
|
+
from tlnt.cli.options import CurlOption, JsonOption, VerboseOption
|
|
13
|
+
from tlnt.cli.output import action_banner, confirm, emit, require_writable, run
|
|
14
|
+
from tlnt.core.api_endpoints import API_ENDPOINTS, ApiEndpoint, command_names
|
|
15
|
+
from tlnt.core.models import Result
|
|
16
|
+
from tlnt.core.services.api import api_get as endpoint_get_action
|
|
17
|
+
from tlnt.core.services.api import api_post as endpoint_post_action
|
|
18
|
+
from tlnt.core.services.api import api_refusal
|
|
19
|
+
|
|
20
|
+
# Each generated group's usage panel and help, in the order --help lists them.
|
|
21
|
+
ENDPOINT_GROUPS = {
|
|
22
|
+
"time-sheet": ("Attendance", "Track time-sheet tasks and timers."),
|
|
23
|
+
"project": ("Attendance", "Read projects and their members."),
|
|
24
|
+
"shift-list": ("Attendance", "Read the shift list."),
|
|
25
|
+
"shift-request": ("Attendance", "Read shift requests."),
|
|
26
|
+
"multiple-shift": ("Attendance", "Check multiple-shift status for a date."),
|
|
27
|
+
"companies": ("Attendance", "Read and reject overtime plannings."),
|
|
28
|
+
"organisations": ("Attendance", "Read the company's attendance summaries."),
|
|
29
|
+
"approval": ("Approvals", "Approve or reject custom-form requests in bulk."),
|
|
30
|
+
"approval-request": ("Approvals", "Approve or reject requests in bulk."),
|
|
31
|
+
"request": ("Approvals", "List employees for a request."),
|
|
32
|
+
"history-request": ("Approvals", "Read change-shift and delegation history."),
|
|
33
|
+
"mekari-flex": ("Pay", "Check Mekari Flex status."),
|
|
34
|
+
"employee": ("People", "Read employees, leave and the org chart."),
|
|
35
|
+
"employees": ("People", "Read an employee's education and experience."),
|
|
36
|
+
"my-info": ("People", "Read your own files, family and education."),
|
|
37
|
+
"subordinates": ("People", "List your subordinates."),
|
|
38
|
+
"reprimand": ("People", "Read reprimands."),
|
|
39
|
+
"comment": ("People", "Read reprimand feedback."),
|
|
40
|
+
"organization": ("Company", "Read the organization structure."),
|
|
41
|
+
"branch": ("Company", "List company branches."),
|
|
42
|
+
"sbus": ("Company", "List the company's business units."),
|
|
43
|
+
"consultant": ("Company", "Read the consultant company."),
|
|
44
|
+
"onboarding": ("Company", "Read onboarding tasks, forms and documents."),
|
|
45
|
+
"custom-form": ("Company", "List custom forms."),
|
|
46
|
+
"custom-form-submissions": ("Company", "Read custom-form submissions."),
|
|
47
|
+
"dashboard": ("Company", "Read dashboard announcements, icons and reviews."),
|
|
48
|
+
"ems": ("Company", "Read company and mobile settings."),
|
|
49
|
+
"toggle": ("Company", "Read the app's feature toggles."),
|
|
50
|
+
"progress-bar": ("Company", "Read a progress bar by type."),
|
|
51
|
+
}
|
|
52
|
+
_CAMEL = re.compile(r"(?<=[a-z0-9])(?=[A-Z])")
|
|
53
|
+
_OUTPUT_OPTIONS = (
|
|
54
|
+
("json_output", JsonOption),
|
|
55
|
+
("verbose", VerboseOption),
|
|
56
|
+
("curl", CurlOption),
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def _json_body(body: str | None) -> Any:
|
|
61
|
+
if body is None:
|
|
62
|
+
return None
|
|
63
|
+
try:
|
|
64
|
+
return json.loads(body)
|
|
65
|
+
except ValueError as error:
|
|
66
|
+
raise typer.BadParameter("--body must be JSON") from error
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def option_name(key: str) -> str:
|
|
70
|
+
"""The option for a query or body key: inboxID is --inbox-id, per_page --per-page."""
|
|
71
|
+
return _CAMEL.sub("-", key).replace("_", "-").lower()
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def argument_name(name: str) -> str:
|
|
75
|
+
"""The metavar for a {name} slot: formId is FORM_ID, policy_id is POLICY_ID."""
|
|
76
|
+
return option_name(name).upper().replace("-", "_")
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
def _post(
|
|
80
|
+
row: ApiEndpoint,
|
|
81
|
+
args: dict[str, str],
|
|
82
|
+
given: dict[str, str],
|
|
83
|
+
json_output: bool,
|
|
84
|
+
verbose: bool,
|
|
85
|
+
) -> None:
|
|
86
|
+
"""Send one row's POST after the read-only check, the refusal and the prompt."""
|
|
87
|
+
require_writable(json_output)
|
|
88
|
+
if row.encoding == "json":
|
|
89
|
+
fields, json_body = {}, _json_body(given.get("body"))
|
|
90
|
+
else:
|
|
91
|
+
fields, json_body = given, None
|
|
92
|
+
refused = api_refusal(row, args, fields, json_body)
|
|
93
|
+
if refused is not None:
|
|
94
|
+
emit(refused, json_output)
|
|
95
|
+
return
|
|
96
|
+
action_banner("API post", enabled=not json_output)
|
|
97
|
+
shown = json.dumps(json_body if row.encoding == "json" else fields)
|
|
98
|
+
typer.echo(f"POST {row.fill(args)}", err=True)
|
|
99
|
+
typer.echo(f"Body: {shown}", err=True)
|
|
100
|
+
if not confirm("Send this request to Talenta?", default=False, err=True):
|
|
101
|
+
emit(Result(False, "api_post_cancelled", "API request cancelled"), json_output)
|
|
102
|
+
return
|
|
103
|
+
run(
|
|
104
|
+
"Sending API request...",
|
|
105
|
+
lambda: endpoint_post_action(row, args, fields, json_body),
|
|
106
|
+
json_output,
|
|
107
|
+
verbose,
|
|
108
|
+
)
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
def _option_help(row: ApiEndpoint, key: str) -> str:
|
|
112
|
+
if row.encoding == "json":
|
|
113
|
+
return f"JSON request body with the keys {', '.join(row.body)}."
|
|
114
|
+
sent = f"Sent as the {'query value' if row.method == 'GET' else 'body field'} {key}."
|
|
115
|
+
return f"{sent} Defaults to your user id." if key == row.user_key else sent
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
def _parameters(row: ApiEndpoint, keys: tuple[str, ...]) -> list[inspect.Parameter]:
|
|
119
|
+
"""An argument per {name} slot, an option per key, then the output options."""
|
|
120
|
+
keyword = inspect.Parameter.KEYWORD_ONLY
|
|
121
|
+
arguments = [
|
|
122
|
+
inspect.Parameter(
|
|
123
|
+
f"arg_{index}",
|
|
124
|
+
inspect.Parameter.POSITIONAL_OR_KEYWORD,
|
|
125
|
+
annotation=Annotated[
|
|
126
|
+
str,
|
|
127
|
+
typer.Argument(
|
|
128
|
+
metavar=argument_name(name),
|
|
129
|
+
help=f"Value for {{{name}}} in the path.",
|
|
130
|
+
show_default=False,
|
|
131
|
+
),
|
|
132
|
+
],
|
|
133
|
+
)
|
|
134
|
+
for index, name in enumerate(row.args)
|
|
135
|
+
]
|
|
136
|
+
options = [
|
|
137
|
+
inspect.Parameter(
|
|
138
|
+
f"opt_{index}",
|
|
139
|
+
keyword,
|
|
140
|
+
default=inspect.Parameter.empty if key in row.required else None,
|
|
141
|
+
annotation=Annotated[
|
|
142
|
+
str if key in row.required else str | None,
|
|
143
|
+
typer.Option(f"--{option_name(key)}", help=_option_help(row, key)),
|
|
144
|
+
],
|
|
145
|
+
)
|
|
146
|
+
for index, key in enumerate(keys)
|
|
147
|
+
]
|
|
148
|
+
output = [
|
|
149
|
+
inspect.Parameter(name, keyword, default=False, annotation=option)
|
|
150
|
+
for name, option in _OUTPUT_OPTIONS
|
|
151
|
+
]
|
|
152
|
+
return arguments + options + output
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
def endpoint_command(row: ApiEndpoint) -> Callable[..., None]:
|
|
156
|
+
"""The command for one row: its {name} slots are arguments, its names options."""
|
|
157
|
+
keys = ("body",) if row.encoding == "json" else row.query or row.body
|
|
158
|
+
|
|
159
|
+
def command(**values: Any) -> None:
|
|
160
|
+
args = {name: values[f"arg_{index}"] for index, name in enumerate(row.args)}
|
|
161
|
+
given = {
|
|
162
|
+
key: values[f"opt_{index}"]
|
|
163
|
+
for index, key in enumerate(keys)
|
|
164
|
+
if values[f"opt_{index}"] is not None
|
|
165
|
+
}
|
|
166
|
+
json_output, verbose = values["json_output"], values["verbose"]
|
|
167
|
+
if row.method == "POST":
|
|
168
|
+
_post(row, args, given, json_output, verbose)
|
|
169
|
+
return
|
|
170
|
+
run(
|
|
171
|
+
"Loading API response...",
|
|
172
|
+
lambda: endpoint_get_action(row, args, given),
|
|
173
|
+
json_output,
|
|
174
|
+
verbose,
|
|
175
|
+
)
|
|
176
|
+
|
|
177
|
+
parameters = _parameters(row, keys)
|
|
178
|
+
command.__signature__ = inspect.Signature(parameters)
|
|
179
|
+
command.__annotations__ = {parameter.name: parameter.annotation for parameter in parameters}
|
|
180
|
+
command.__doc__ = f"{row.summary}\n\n{row.method} {row.path}"
|
|
181
|
+
return command
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
def _command_name(info: CommandInfo) -> str:
|
|
185
|
+
return info.name or info.callback.__name__.replace("_", "-")
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
def register_endpoint_commands(
|
|
189
|
+
app: typer.Typer,
|
|
190
|
+
named: Mapping[str, typer.Typer],
|
|
191
|
+
rows: Iterable[ApiEndpoint] = API_ENDPOINTS,
|
|
192
|
+
) -> None:
|
|
193
|
+
"""Add one command per row: to its named group, or to its ENDPOINT_GROUPS group.
|
|
194
|
+
|
|
195
|
+
Typer keeps the last command registered under a name, so a clash with a
|
|
196
|
+
named command or group would replace it silently; it raises instead, and
|
|
197
|
+
so does a new group with no help panel.
|
|
198
|
+
"""
|
|
199
|
+
names = command_names(rows)
|
|
200
|
+
roots = {_command_name(info) for info in app.registered_commands}
|
|
201
|
+
roots |= {info.name for info in app.registered_groups}
|
|
202
|
+
for group, command in names.values():
|
|
203
|
+
known = named.get(group)
|
|
204
|
+
if known is None and group in roots:
|
|
205
|
+
raise ValueError(f"tlnt {group} is already a named command")
|
|
206
|
+
if known is not None and command in map(_command_name, known.registered_commands):
|
|
207
|
+
raise ValueError(f"tlnt {group} {command} is already a named command")
|
|
208
|
+
if known is None and group not in ENDPOINT_GROUPS:
|
|
209
|
+
raise ValueError(f"tlnt {group} has no help panel")
|
|
210
|
+
used = {group for group, _ in names.values() if group not in named}
|
|
211
|
+
groups = {
|
|
212
|
+
group: typer.Typer(no_args_is_help=True, help=ENDPOINT_GROUPS[group][1])
|
|
213
|
+
for group in ENDPOINT_GROUPS
|
|
214
|
+
if group in used
|
|
215
|
+
}
|
|
216
|
+
for row, (group, command) in names.items():
|
|
217
|
+
target = named[group] if group in named else groups[group]
|
|
218
|
+
target.command(name=command)(endpoint_command(row))
|
|
219
|
+
for group, sub in groups.items():
|
|
220
|
+
app.add_typer(sub, name=group, rich_help_panel=ENDPOINT_GROUPS[group][0])
|
|
@@ -8,7 +8,7 @@ from typing import Annotated, Any
|
|
|
8
8
|
import typer
|
|
9
9
|
from typer.core import TyperGroup
|
|
10
10
|
|
|
11
|
-
from tlnt.cli.commands.api import
|
|
11
|
+
from tlnt.cli.commands.api import register_endpoint_commands
|
|
12
12
|
from tlnt.cli.commands.attendance import (
|
|
13
13
|
attendance_approve,
|
|
14
14
|
attendance_clockin,
|
|
@@ -76,11 +76,11 @@ app = typer.Typer(
|
|
|
76
76
|
no_args_is_help=True,
|
|
77
77
|
help=(
|
|
78
78
|
"[bold cyan]tlnt[/] — unofficial CLI for Mekari Talenta.\n\n"
|
|
79
|
-
"[yellow]Use at your own risk:[/] this tool signs in as you and can "
|
|
80
|
-
"submit real attendance and time-off requests on your behalf."
|
|
79
|
+
"[not dim][bold yellow]Use at your own risk:[/] this tool signs in as you and can "
|
|
80
|
+
"submit real attendance and time-off requests on your behalf.[/not dim]"
|
|
81
81
|
),
|
|
82
82
|
epilog=(
|
|
83
|
-
"Docs: https://
|
|
83
|
+
"Docs: https://tlnt-docs.vercel.app — add [cyan]--json[/] for "
|
|
84
84
|
"machine output."
|
|
85
85
|
),
|
|
86
86
|
)
|
|
@@ -103,16 +103,7 @@ attendance_app.command(name="clock-out")(attendance_clockout)
|
|
|
103
103
|
attendance_app.command(name="summary-list")(attendance_summary_list)
|
|
104
104
|
attendance_app.command(name="summary-metrics")(attendance_summary_metrics)
|
|
105
105
|
attendance_app.command(name="approve")(attendance_approve)
|
|
106
|
-
app.add_typer(attendance_app, name="attendance", rich_help_panel="
|
|
107
|
-
|
|
108
|
-
# Add commands to the notification sub-app
|
|
109
|
-
notification_app.command(name="count")(notification_count)
|
|
110
|
-
notification_app.command(name="list")(notification_list)
|
|
111
|
-
notification_app.command(name="attendance-list")(notification_attendance_list)
|
|
112
|
-
notification_app.command(name="timeoff-list")(notification_timeoff_list)
|
|
113
|
-
notification_app.command(name="overtime-list")(notification_overtime_list)
|
|
114
|
-
notification_app.command(name="detail")(notification_detail)
|
|
115
|
-
app.add_typer(notification_app, name="notification", rich_help_panel="Workflows")
|
|
106
|
+
app.add_typer(attendance_app, name="attendance", rich_help_panel="Attendance")
|
|
116
107
|
|
|
117
108
|
timeoff_app.command(name="types-list")(timeoff_types_list)
|
|
118
109
|
timeoff_app.command(name="balance")(timeoff_balance)
|
|
@@ -122,7 +113,16 @@ timeoff_app.command(name="detail")(timeoff_detail)
|
|
|
122
113
|
timeoff_app.command(name="request")(timeoff_request)
|
|
123
114
|
timeoff_app.command(name="cancel")(timeoff_cancel)
|
|
124
115
|
timeoff_app.command(name="approve")(timeoff_approve)
|
|
125
|
-
app.add_typer(timeoff_app, name="timeoff", rich_help_panel="
|
|
116
|
+
app.add_typer(timeoff_app, name="timeoff", rich_help_panel="Time off")
|
|
117
|
+
|
|
118
|
+
# Add commands to the notification sub-app
|
|
119
|
+
notification_app.command(name="count")(notification_count)
|
|
120
|
+
notification_app.command(name="list")(notification_list)
|
|
121
|
+
notification_app.command(name="attendance-list")(notification_attendance_list)
|
|
122
|
+
notification_app.command(name="timeoff-list")(notification_timeoff_list)
|
|
123
|
+
notification_app.command(name="overtime-list")(notification_overtime_list)
|
|
124
|
+
notification_app.command(name="detail")(notification_detail)
|
|
125
|
+
app.add_typer(notification_app, name="notification", rich_help_panel="Approvals")
|
|
126
126
|
|
|
127
127
|
calendar_app.command(name="holiday")(calendar_holiday)
|
|
128
128
|
calendar_app.command(name="timeoff")(calendar_timeoff)
|
|
@@ -130,26 +130,36 @@ calendar_app.command(name="index")(calendar_index)
|
|
|
130
130
|
calendar_app.command(name="my-birthday")(calendar_my_birthday)
|
|
131
131
|
calendar_app.command(name="birthday")(calendar_birthday)
|
|
132
132
|
calendar_app.command(name="activity")(calendar_activity)
|
|
133
|
-
app.add_typer(calendar_app, name="calendar", rich_help_panel="
|
|
133
|
+
app.add_typer(calendar_app, name="calendar", rich_help_panel="Attendance")
|
|
134
134
|
|
|
135
135
|
overtime_app = typer.Typer(no_args_is_help=True, help="Read and approve overtime requests.")
|
|
136
136
|
overtime_app.command(name="list")(overtime_list)
|
|
137
137
|
overtime_app.command(name="detail")(overtime_detail)
|
|
138
138
|
overtime_app.command(name="approve")(overtime_approve)
|
|
139
|
-
app.add_typer(overtime_app, name="overtime", rich_help_panel="
|
|
139
|
+
app.add_typer(overtime_app, name="overtime", rich_help_panel="Attendance")
|
|
140
140
|
|
|
141
141
|
payslip_app = typer.Typer(no_args_is_help=True, help="Read and save payslips.")
|
|
142
142
|
payslip_app.command(name="show")(payslip_show)
|
|
143
143
|
payslip_app.command(name="download")(payslip_download)
|
|
144
|
-
app.add_typer(payslip_app, name="payslip", rich_help_panel="
|
|
144
|
+
app.add_typer(payslip_app, name="payslip", rich_help_panel="Pay")
|
|
145
145
|
|
|
146
146
|
reimbursement_app = typer.Typer(no_args_is_help=True, help="Read reimbursement policies.")
|
|
147
147
|
reimbursement_app.command(name="policies")(reimbursement_policies)
|
|
148
|
-
app.add_typer(reimbursement_app, name="reimbursement", rich_help_panel="
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
app
|
|
148
|
+
app.add_typer(reimbursement_app, name="reimbursement", rich_help_panel="Pay")
|
|
149
|
+
|
|
150
|
+
# One command per Talenta API endpoint row, after every named command exists.
|
|
151
|
+
register_endpoint_commands(
|
|
152
|
+
app,
|
|
153
|
+
{
|
|
154
|
+
"attendance": attendance_app,
|
|
155
|
+
"notification": notification_app,
|
|
156
|
+
"timeoff": timeoff_app,
|
|
157
|
+
"calendar": calendar_app,
|
|
158
|
+
"overtime": overtime_app,
|
|
159
|
+
"payslip": payslip_app,
|
|
160
|
+
"reimbursement": reimbursement_app,
|
|
161
|
+
},
|
|
162
|
+
)
|
|
153
163
|
|
|
154
164
|
|
|
155
165
|
_log = logger.bind(component="cli")
|