Skip to content

Commit

Permalink
Fix config adding logic and add to dev guide.
Browse files Browse the repository at this point in the history
Fix #187
  • Loading branch information
alichtman committed Nov 14, 2018
1 parent 71c2fd0 commit 59094a7
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 16 deletions.
File renamed without changes.
6 changes: 6 additions & 0 deletions docs/development-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,9 @@ $ pipenv run python3 -m pytest
```

Make sure all tests pass before opening a PR!

**Code Style**

All new code should follow the code style established in the code base. PRs with changes in indentation style _will not be merged._

PEP8 is generally to be followed, but I think that prettier code to look at in an editor is more important that strictly following PEP8.
3 changes: 0 additions & 3 deletions shallow_backup/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,4 @@ def cli(show, all, dotfiles, configs, packages, fonts, old_path, new_path, remot


if __name__ == "__main__":
"""
I'm just here so I don't get fined.
"""
cli()
1 change: 1 addition & 0 deletions shallow_backup/backup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from .config import get_config


# TODO: Move to UTILS.
def overwrite_dir_prompt_if_needed(path, needed):
"""
Prompts the user before deleting the directory if needed.
Expand Down
1 change: 1 addition & 0 deletions shallow_backup/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ def write_config(config):
json.dump(config, f, indent=4)


# TODO: Refactor to `prepare_config_map()`
def prepare_config_path():
"""
Get compatible config paths, format them as [(LOC, DEST), ...]
Expand Down
17 changes: 4 additions & 13 deletions shallow_backup/prompts.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,20 +85,11 @@ def add_to_config_prompt():

elif section == "config":
# Prompt for folder name
print_green_bold("Enter a name for this config:".format(section))
print_green_bold("Enter a name for this config:")
dir_name = input()

# TODO: Remove this plist special case logic (#187)
# Handle plist and regular config.
if expanded_path.endswith(".plist"):
config_key = "plist_path_to_dest_map"
# Make dest path $SB/config/plist/FILENAME
to_add_to_cfg = (expanded_path, os.path.join("plist", dir_name))
print_blue_bold("Adding {} to plist backup.".format(expanded_path))
else:
config_key = "config_path_to_dest_map"
to_add_to_cfg = (expanded_path, dir_name)
print_blue_bold("Adding {} to config backup.".format(expanded_path))
config_key = "config_path_to_dest_map"
to_add_to_cfg = (expanded_path, dir_name)
print_blue_bold("Adding {} to config backup.".format(expanded_path))

# Get dictionary of {path_to_backup: dest, ...}
config_path_dict = config[config_key]
Expand Down

0 comments on commit 59094a7

Please sign in to comment.