Skip to content

Commit

Permalink
add docs and change name of env var
Browse files Browse the repository at this point in the history
  • Loading branch information
alichtman committed Feb 13, 2025
1 parent 4ffcac4 commit e7d3bf9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,12 +184,11 @@ By default, `shallow-backup` backs these up.

### Configuration

If you'd like to modify which files are backed up, you have to edit the `JSON` config file, located at `~/.config/shallow-backup.json`. There are two ways to do this.
If you'd like to modify which files are backed up, you can edit the `JSON` config file. This file is looked for in the following locations, in this order:

1. Select the appropriate option in the CLI and follow the prompts.
2. Open the file in a text editor and make your changes.

Editing the file in a text editor will give you more control and be faster.
1. `$SHALLOW_BACKUP_CONFIG_DIR/shallow-backup.json`
2. `$XDG_CONFIG_HOME/shallow-backup.json`
3. `~/.config/shallow-backup.json`

#### Conditional Backup and Reinstallation

Expand Down
4 changes: 2 additions & 2 deletions shallow_backup/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@


def get_xdg_config_path() -> str:
"""Returns path to $XDG_CONFIG_HOME, or ~/.config, if it doesn't exist."""
return environ.get("SHALLOW_BACKUP_HOME") or environ.get("XDG_CONFIG_HOME") or path.join(path.expanduser("~"), ".config")
"""Returns path to $SHALLOW_BACKUP_CONFIG_DIR (if set), $XDG_CONFIG_HOME, or ~/.config if none of those exist."""
return environ.get("SHALLOW_BACKUP_CONFIG_DIR") or environ.get("XDG_CONFIG_HOME") or path.join(path.expanduser("~"), ".config")


@lru_cache(maxsize=1)
Expand Down

0 comments on commit e7d3bf9

Please sign in to comment.