Skip to content

Commit a7e1d34

Browse files
committed
✨ Support category
Remove error when wakatime-cli doesn't exist
1 parent 1e65b89 commit a7e1d34

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[build-system]
2-
requires = ["setuptools >= 45", "setuptools_scm[toml] >= 6.2", "setuptools-generate"]
2+
requires = ["setuptools_scm[toml] >= 6.2", "setuptools-generate"]
33
build-backend = "setuptools.build_meta"
44

55
# https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html

src/repl_python_wakatime/__init__.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
def send_wakatime_heartbeat(
1515
project: str = "",
16+
category: str = "coding",
1617
plugin: str = "repl-python-wakatime",
1718
filenames: list[str] = [".git"],
1819
detect_func: Callable[[str], bool] = os.path.isdir,
@@ -26,6 +27,8 @@ def send_wakatime_heartbeat(
2627
2728
:param project:
2829
:type project: str
30+
:param category:
31+
:type category: str
2932
:param plugin:
3033
:type plugin: str
3134
:param filenames:
@@ -42,6 +45,7 @@ def send_wakatime_heartbeat(
4245
[
4346
"wakatime-cli",
4447
"--write",
48+
f"--category={category}",
4549
f"--plugin={plugin}",
4650
"--entity-type=app",
4751
"--entity=python",
@@ -61,9 +65,6 @@ def wakatime_hook(*args: Any, **kwargs: Any) -> None:
6165
:type kwargs: Any
6266
:rtype: None
6367
"""
64-
if which("wakatime-cli") is None:
65-
logger.error("Please install wakatime-cli firstly!")
66-
return
6768
task = Thread(target=send_wakatime_heartbeat, args=args, kwargs=kwargs)
6869
task.daemon = True
6970
task.start()

0 commit comments

Comments
 (0)