From 928fd4b1a0ff6189bcd8a3e85174e664d63cd02b Mon Sep 17 00:00:00 2001 From: spencerwooo Date: Wed, 25 Jan 2023 16:06:24 +0800 Subject: [PATCH 1/2] fix: config root missing `$HOME/.config/bitsrun/` on macOS --- README.md | 12 ++++++------ bitsrun/config.py | 12 +++++++++++- pyproject.toml | 2 +- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index be89fdf..5370bdd 100644 --- a/README.md +++ b/README.md @@ -8,14 +8,14 @@ _A headless login / logout script for 10.0.0.55 at BIT._ You need at least **Python 3.8**. We recommend installing with `pipx`. -```bash +```shell python3 -m pip install --user pipx python3 -m pipx ensurepath ``` After which, install `bitsrun` with `pipx`. -```bash +```shell pipx install bitsrun ``` @@ -55,7 +55,7 @@ This file should be put under the following directory: Now you can simply call: -```bash +```shell bitsrun login bitsrun logout ``` @@ -78,7 +78,7 @@ Import the two Raycast scripts from [`./scripts`](./scripts/) and setup your con Install and run: -```bash +```shell # Create virtual env and install deps poetry install @@ -91,7 +91,7 @@ pre-commit install Build: -```bash +```shell # Bump version poetry version x.x.x @@ -101,7 +101,7 @@ poetry build Publish: -```bash +```shell poetry publish ``` diff --git a/bitsrun/config.py b/bitsrun/config.py index af73ed2..f826053 100644 --- a/bitsrun/config.py +++ b/bitsrun/config.py @@ -17,13 +17,22 @@ def get_config_paths() -> map: - `C:\ProgramData\bitsrun\bit-user.json` - `~\AppData\Roaming\bitsrun\bit-user.json` - On macOS and Linux: + On Linux: - `/etc/bitsrun/bit-user.json` + - `/etc/xdg/bitsrun/bit-user.json` - `$XDG_CONFIG_HOME/bitsrun/bit-user.json` - `~/.config/bitsrun/bit-user.json` - `~/.config/bit-user.json` + On macOS: + + - `/etc/bit-user.json` + - `/Library/Preferences/bitsrun/bit-user.json` + - `$HOME/Library/Preferences/bitsrun/bit-user.json` + - `$HOME/.config/bit-user.json` + - `$HOME/.config/bitsrun/bit-user.json` + Returns: A map of possible paths of the configuration file based on the current platform. """ @@ -43,6 +52,7 @@ def get_config_paths() -> map: paths.append(Path(xdg_config_home)) else: paths.append(Path.home() / ".config") + paths.append(paths[-1] / _APP_NAME) else: paths.append(user_config_path()) diff --git a/pyproject.toml b/pyproject.toml index c8c8006..76f3f99 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "bitsrun" -version = "3.3.0" +version = "3.3.1" description = "A headless login / logout script for 10.0.0.55" authors = ["spencerwooo "] license = "WTFPL" From 1b9b676d37a302f3d6e87809b5b15c34926f6b43 Mon Sep 17 00:00:00 2001 From: spencerwooo Date: Wed, 25 Jan 2023 17:22:21 +0800 Subject: [PATCH 2/2] docs: fix possible config paths on linux --- bitsrun/config.py | 1 - 1 file changed, 1 deletion(-) diff --git a/bitsrun/config.py b/bitsrun/config.py index f826053..950cb32 100644 --- a/bitsrun/config.py +++ b/bitsrun/config.py @@ -21,7 +21,6 @@ def get_config_paths() -> map: - `/etc/bitsrun/bit-user.json` - `/etc/xdg/bitsrun/bit-user.json` - - `$XDG_CONFIG_HOME/bitsrun/bit-user.json` - `~/.config/bitsrun/bit-user.json` - `~/.config/bit-user.json`