diff --git a/README.md b/README.md index 30a5f729..fae55e83 100644 --- a/README.md +++ b/README.md @@ -64,32 +64,32 @@ Usage: shallow-backup [OPTIONS] Written by Aaron Lichtman (@alichtman). Options: - --add_dot TEXT Add a dotfile or dotfolder to config by path. - -configs Back up app config files. - -delete_config Delete config file. - -destroy_backup Delete backup directory. - -dotfiles Back up dotfiles. - -dry_run Don't backup or reinstall any files, just give - verbose output. - - -fonts Back up installed fonts. - -full_backup Full back up. - --new_path TEXT Input a new back up directory path. - -no_splash Don't display splash screen. - -old_path Skip setting new back up directory path prompt. - -packages Back up package libraries. - -reinstall_all Full reinstallation. - -reinstall_configs Reinstall configs. - -reinstall_dots Reinstall dotfiles and dotfolders. - -reinstall_fonts Reinstall fonts. - -reinstall_packages Reinstall packages. - --remote TEXT Set remote URL for the git repo. - -separate_dotfiles_repo Use if you are trying to maintain a separate - dotfiles repo and running into issue #229. - - -show Display config file. - -v, --version Display version and author info. - -help, -h, --help Show this message and exit. + --add-dot TEXT Add a dotfile or dotfolder to config by path. + -backup-all Full back up. + -backup-configs Back up app config files. + -backup-dots Back up dotfiles. + -backup-packages Back up package libraries. + -delete-config Delete config file. + -destroy-backup Delete backup directory. + -dry-run Don't backup or reinstall any files, just give + verbose output. + + -backup-fonts Back up installed fonts. + --new-path TEXT Input a new back up directory path. + -no-new-backup-path-prompt Skip setting new back up directory path prompt. + -no-splash Don't display splash screen. + -reinstall-all Full reinstallation. + -reinstall-configs Reinstall configs. + -reinstall-dots Reinstall dotfiles and dotfolders. + -reinstall-fonts Reinstall fonts. + -reinstall-packages Reinstall packages. + --remote TEXT Set remote URL for the git repo. + -separate-dotfiles-repo Use if you are trying to maintain a separate + dotfiles repo and running into issue #229. + + -show Display config file. + -v, --version Display version and author info. + -h, -help, --help Show this message and exit. ``` ### Git Integration @@ -113,7 +113,7 @@ backup-dots () { echo "Backing up..." crontab -l > ~/.config/crontab ( - shallow-backup -no_splash -dotfiles -separate_dotfiles_repo + shallow-backup -no-splash -backup-dots -separate-dotfiles-repo cd "$HOME/shallow-backup/dotfiles/" || exit git add . commit_msg="$1" diff --git a/shallow_backup/__main__.py b/shallow_backup/__main__.py index 3de5ba77..0066807d 100644 --- a/shallow_backup/__main__.py +++ b/shallow_backup/__main__.py @@ -11,30 +11,30 @@ # custom help options @click.command(context_settings=dict(help_option_names=['-h', '-help', '--help'])) -@click.option('--add_dot', default=None, help="Add a dotfile or dotfolder to config by path.") -@click.option('-configs', is_flag=True, default=False, help="Back up app config files.") -@click.option('-delete_config', is_flag=True, default=False, help="Delete config file.") -@click.option('-destroy_backup', is_flag=True, default=False, help="Delete backup directory.") -@click.option('-dotfiles', is_flag=True, default=False, help="Back up dotfiles.") -@click.option('-dry_run', is_flag=True, default=False, help="Don't backup or reinstall any files, just give verbose output.") -@click.option('-fonts', is_flag=True, default=False, help="Back up installed fonts.") -@click.option('-full_backup', is_flag=True, default=False, help="Full back up.") -@click.option('--new_path', default=None, help="Input a new back up directory path.") -@click.option('-no_splash', is_flag=True, default=False, help="Don't display splash screen.") -@click.option('-old_path', is_flag=True, default=False, help="Skip setting new back up directory path prompt.") -@click.option('-packages', is_flag=True, default=False, help="Back up package libraries.") -@click.option('-reinstall_all', is_flag=True, default=False, help="Full reinstallation.") -@click.option('-reinstall_configs', is_flag=True, default=False, help="Reinstall configs.") -@click.option('-reinstall_dots', is_flag=True, default=False, help="Reinstall dotfiles and dotfolders.") -@click.option('-reinstall_fonts', is_flag=True, default=False, help="Reinstall fonts.") -@click.option('-reinstall_packages', is_flag=True, default=False, help="Reinstall packages.") +@click.option('--add-dot', default=None, help="Add a dotfile or dotfolder to config by path.") +@click.option('-backup-all', 'backup_all_flag', is_flag=True, default=False, help="Full back up.") +@click.option('-backup-configs', 'backup_configs_flag', is_flag=True, default=False, help="Back up app config files.") +@click.option('-backup-dots', 'backup_dots_flag', is_flag=True, default=False, help="Back up dotfiles.") +@click.option('-backup-packages', 'backup_packages_flag', is_flag=True, default=False, help="Back up package libraries.") +@click.option('-delete-config', is_flag=True, default=False, help="Delete config file.") +@click.option('-destroy-backup', is_flag=True, default=False, help="Delete backup directory.") +@click.option('-dry-run', is_flag=True, default=False, help="Don't backup or reinstall any files, just give verbose output.") +@click.option('-backup-fonts', 'backup_fonts_flag', is_flag=True, default=False, help="Back up installed fonts.") +@click.option('--new-path', default=None, help="Input a new back up directory path.") +@click.option('-no-new-backup-path-prompt', is_flag=True, default=False, help="Skip setting new back up directory path prompt.") +@click.option('-no-splash', is_flag=True, default=False, help="Don't display splash screen.") +@click.option('-reinstall-all', is_flag=True, default=False, help="Full reinstallation.") +@click.option('-reinstall-configs', is_flag=True, default=False, help="Reinstall configs.") +@click.option('-reinstall-dots', is_flag=True, default=False, help="Reinstall dotfiles and dotfolders.") +@click.option('-reinstall-fonts', is_flag=True, default=False, help="Reinstall fonts.") +@click.option('-reinstall-packages', is_flag=True, default=False, help="Reinstall packages.") @click.option('--remote', default=None, help="Set remote URL for the git repo.") -@click.option('-separate_dotfiles_repo', is_flag=True, default=False, help="Use if you are trying to maintain a separate dotfiles repo and running into issue #229.") +@click.option('-separate-dotfiles-repo', is_flag=True, default=False, help="Use if you are trying to maintain a separate dotfiles repo and running into issue #229.") @click.option('-show', is_flag=True, default=False, help="Display config file.") @click.option('--version', '-v', is_flag=True, default=False, help='Display version and author info.') -def cli(add_dot, configs, delete_config, destroy_backup, dotfiles, dry_run, fonts, full_backup, new_path, - no_splash, old_path, packages, reinstall_all, reinstall_configs, - reinstall_dots, reinstall_fonts, reinstall_packages, remote, +def cli(add_dot, backup_configs_flag, delete_config, destroy_backup, backup_dots_flag, dry_run, + backup_fonts_flag, backup_all_flag, new_path, no_splash, no_new_backup_path_prompt, backup_packages_flag, + reinstall_all, reinstall_configs, reinstall_dots, reinstall_fonts, reinstall_packages, remote, separate_dotfiles_repo, show, version): """ \b @@ -48,12 +48,13 @@ def cli(add_dot, configs, delete_config, destroy_backup, dotfiles, dry_run, font # Process CLI args admin_action = any([add_dot, delete_config, destroy_backup, show, version]) - has_cli_arg = any([old_path, full_backup, dotfiles, packages, fonts, configs, - reinstall_dots, reinstall_fonts, reinstall_all, - reinstall_configs, reinstall_packages]) - skip_prompt = any([full_backup, dotfiles, configs, packages, fonts, - reinstall_packages, reinstall_configs, reinstall_dots, - reinstall_fonts]) + has_cli_arg = any([no_new_backup_path_prompt, backup_all_flag, backup_dots_flag, + backup_packages_flag, backup_fonts_flag, backup_configs_flag, + reinstall_dots, reinstall_fonts, reinstall_all, reinstall_configs, + reinstall_packages]) + skip_prompt = any([backup_all_flag, backup_dots_flag, backup_configs_flag, + backup_packages_flag, backup_fonts_flag, reinstall_packages, + reinstall_configs, reinstall_dots, reinstall_fonts]) backup_config = get_config() @@ -125,23 +126,23 @@ def cli(add_dot, configs, delete_config, destroy_backup, dotfiles, dry_run, font reinstall_dots_sb(dotfiles_path, dry_run=dry_run) elif reinstall_all: reinstall_all_sb(dotfiles_path, packages_path, fonts_path, configs_path, dry_run=dry_run) - elif full_backup: + elif backup_all_flag: backup_all(dotfiles_path, packages_path, fonts_path, configs_path, dry_run=dry_run, skip=True) if not dry_run: git_add_all_commit_push(repo, "full_backup") - elif dotfiles: + elif backup_dots_flag: backup_dotfiles(dotfiles_path, dry_run=dry_run, skip=True) if not dry_run: git_add_all_commit_push(repo, "dotfiles", separate_dotfiles_repo) - elif configs: + elif backup_configs_flag: backup_configs(configs_path, dry_run=dry_run, skip=True) if not dry_run: git_add_all_commit_push(repo, "configs") - elif packages: + elif backup_packages_flag: backup_packages(packages_path, dry_run=dry_run, skip=True) if not dry_run: git_add_all_commit_push(repo, "packages") - elif fonts: + elif backup_fonts_flag: backup_fonts(fonts_path, dry_run=dry_run, skip=True) if not dry_run: git_add_all_commit_push(repo, "fonts")