Skip to content

Commit

Permalink
fix: use XDG_CONFIG_HOME in config page
Browse files Browse the repository at this point in the history
  • Loading branch information
iloveitaly committed Aug 14, 2024
1 parent a3e0097 commit 1b49a5f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Get the local variables list as tree.
![](/images/image5.png)

## Config
Config is specified in **setup.cfg** and can be local or global. Local config (current working directory) has precedence over global (default) one. Global config must be located in `$XDG_CONFIG_HOME/pdbr/` directory.
Config is specified in **setup.cfg** and can be local or global. Local config (current working directory) has precedence over global (default) one. Global config must be located at `$XDG_CONFIG_HOME/pdbr/setup.cfg`.

### Style
In order to use Rich's traceback, style, and theme:
Expand Down Expand Up @@ -98,6 +98,8 @@ pdbr.set_trace(console=console)
store_history=.pdbr_history
```

By default, history is stored globally in `~/.pdbr_history`.

## Celery
In order to use **Celery** remote debugger with pdbr, use ```celery_set_trace``` as below sample. For more information see the [Celery user guide](https://docs.celeryproject.org/en/stable/userguide/debugging.html).

Expand Down
4 changes: 3 additions & 1 deletion pdbr/utils.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import atexit
import configparser
from pathlib import Path
Expand Down Expand Up @@ -50,7 +51,8 @@ def read_config():
config.sections()

setup_filename = "setup.cfg"
global_config_path = Path.home() / ".config" / "pdbr" / setup_filename
xdg_config_home = Path(os.getenv('XDG_CONFIG_HOME', Path.home() / ".config"))
global_config_path = xdg_config_home / "pdbr" / setup_filename
cwd_config_path = Path.cwd() / setup_filename
config_path = cwd_config_path.exists() and cwd_config_path or global_config_path

Expand Down

0 comments on commit 1b49a5f

Please sign in to comment.