1212
1313# custom help options
1414@click .command (context_settings = dict (help_option_names = ['-h' , '-help' , '--help' ]))
15+ @click .option ('--add' , default = None , help = "Add a dotfile or dotfolder by path." )
1516@click .option ('-all' , is_flag = True , default = False , help = "Full back up." )
1617@click .option ('-configs' , is_flag = True , default = False , help = "Back up app config files." )
1718@click .option ('-delete_config' , is_flag = True , default = False , help = "Delete config file." )
3132@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." )
3233@click .option ('-show' , is_flag = True , default = False , help = "Display config file." )
3334@click .option ('--version' , '-v' , is_flag = True , default = False , help = 'Display version and author info.' )
34- def cli (all , configs , delete_config , destroy_backup , dotfiles , fonts , new_path ,
35+ def cli (add , all , configs , delete_config , destroy_backup , dotfiles , fonts , new_path ,
3536 no_splash , old_path , packages , reinstall_all , reinstall_configs ,
3637 reinstall_dots , reinstall_fonts , reinstall_packages , remote ,
3738 separate_dotfiles_repo , show , version ):
@@ -45,13 +46,16 @@ def cli(all, configs, delete_config, destroy_backup, dotfiles, fonts, new_path,
4546 upgrade_from_pre_v3 ()
4647
4748 # Process CLI args
48- admin_action = any ([version , delete_config , destroy_backup , show ])
49+ admin_action = any ([add , delete_config , destroy_backup , show , version ])
4950 has_cli_arg = any ([old_path , all , dotfiles , packages , fonts , configs ,
5051 reinstall_dots , reinstall_fonts , reinstall_all ,
5152 reinstall_configs , reinstall_packages ])
5253 skip_prompt = any ([all , dotfiles , configs , packages , fonts , reinstall_packages , reinstall_configs , reinstall_dots ,
5354 reinstall_fonts ])
5455
56+ safe_create_config ()
57+ backup_config = get_config ()
58+
5559 # Perform administrative action and exit.
5660 if admin_action :
5761 if version :
@@ -63,13 +67,14 @@ def cli(all, configs, delete_config, destroy_backup, dotfiles, fonts, new_path,
6367 destroy_backup_dir (backup_home_path )
6468 elif show :
6569 show_config ()
70+ elif add :
71+ new_config = add_path (backup_config , add )
72+ write_config (new_config )
6673 sys .exit ()
6774
6875 # Start CLI
6976 if not no_splash :
7077 splash_screen ()
71- safe_create_config ()
72- backup_config = get_config ()
7378
7479 # User entered a new path, so update the config
7580 if new_path :
0 commit comments