Skip to content

Commit

Permalink
✨ Support category
Browse files Browse the repository at this point in the history
Remove error when wakatime-cli doesn't exist
  • Loading branch information
Freed-Wu committed Mar 21, 2023
1 parent 1e65b89 commit a7e1d34
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["setuptools >= 45", "setuptools_scm[toml] >= 6.2", "setuptools-generate"]
requires = ["setuptools_scm[toml] >= 6.2", "setuptools-generate"]
build-backend = "setuptools.build_meta"

# https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html
Expand Down
7 changes: 4 additions & 3 deletions src/repl_python_wakatime/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

def send_wakatime_heartbeat(
project: str = "",
category: str = "coding",
plugin: str = "repl-python-wakatime",
filenames: list[str] = [".git"],
detect_func: Callable[[str], bool] = os.path.isdir,
Expand All @@ -26,6 +27,8 @@ def send_wakatime_heartbeat(
:param project:
:type project: str
:param category:
:type category: str
:param plugin:
:type plugin: str
:param filenames:
Expand All @@ -42,6 +45,7 @@ def send_wakatime_heartbeat(
[
"wakatime-cli",
"--write",
f"--category={category}",
f"--plugin={plugin}",
"--entity-type=app",
"--entity=python",
Expand All @@ -61,9 +65,6 @@ def wakatime_hook(*args: Any, **kwargs: Any) -> None:
:type kwargs: Any
:rtype: None
"""
if which("wakatime-cli") is None:
logger.error("Please install wakatime-cli firstly!")
return
task = Thread(target=send_wakatime_heartbeat, args=args, kwargs=kwargs)
task.daemon = True
task.start()

0 comments on commit a7e1d34

Please sign in to comment.