Package: copy-to
Copy-toA little python script I use in conjunction with git so you can easily copy (config) files located outside of a git repository to one (or to wherever you want to). Useful for dotfiles and such.Available on with pip/pipx:https://pypi.org/project/copy-to/Depends onargcomplete,GitPython,prompt_toolkitInstall it with:Linux:sudo apt install pipx / sudo pacman -S python-pipx
pipx install copy-toWindows Powershell:winget install python3
python3 -m pip install --user pipx
python3 -m pipx ensurepath
python3 -m pipx install copy-toOn linux, try running it once if autocompletions aren't workingYou can also run:sudo activate-global-python-argcompleteSadly I have been unable to figure out as of now how to setup autocompletions on Windows.How to use it:Add a pairset of destination folder - source files and/or directories withcopy-to add myname destination_folder sourcefile1 (sourcefolder1 sourcefile2 sourcefile3 sourcefolder2/*) ...Copy the files to their destination by runningcopy-to run myname1 (myname2)Or copy the files back to source by runningcopy-to run-reverse myname1 (myname2)When the destination is missing, a prompt will ask you if you want to create the destination folder.Run and run-reverse can also run without arguments when present in a git repository that has configured copy-to (Excluding global gitconfig). This is so it can be hooked to a git macro more easily, f.ex. with an alias (alias git-status="git status && copy-to run") or on startup ofLazygit.[copy-to]  
    run = myname1 myname2  
    file = myconf.jsonThis can be setup withcopy-to add mynameandcopy-to set-git mynameorcopy-to add mynameandcopy-to run/copy-to run-reverseafter wich a prompt will ask if you want to set it up with git. Bothcopy-to runandcopy-to run-reversewill run using the samerunarguments. A custom conf.json can be also be setup and will always take precedence over other file options when set up.Quick setup for dotfilesThis will setup a git repository for your firefox configuration files using copy-to on Windows.Initialize git repository and setup copy-toFirst we create a local git repository and cd into it.git init firefox-files  
cd firefox-filesThen we add everything in the firefox 'profile' folder programmatically using copy-to:- First we open the profile folder by opening firefox-> Help-> More Troubleshooting Information-> Open 'Profile' Folder and copy the folder path.- Then we runcopy-to add firefox-profiles firefox ""to add a the target folder but without the source files. This will also create a subfolder in our git repository.- Then we iterate over each file in our profile folder (dont forget to replace the path with the path you copied earlier):Get-ChildItem "C:\Users\username\AppData\Roaming\Mozilla\Firefox\Profiles\release" -Filter * |  
ForEach-Object {copy-to add-source firefox-profiles "C:\Users\username\AppData\Roaming\Mozilla\Firefox\Profiles\release\$_" }Then we runcopy-to run firefox-profilesto copy the files to the target folder.Now that everything related to firefox is inside our local git repository, we can start setting up our remote repository.Setup ssh for githubFollowing the instructions onGithub:- We create a public/private keypair usingssh-keygen -t ed25519. This will save our keypair insideC:\Users\username\.ssh\id_ed25519andC:\Users\username\.ssh\id_ed25519.pubrespectively.- Then we open up an administrator powershell and run:Get-Service -Name ssh-agent | Set-Service -StartupType Manual  
Start-Service ssh-agentto startup the ssh-agent.- Back inside a regular powershell, we add our private key usingssh-add C:\Users\username\.ssh\id_ed25519.- Then we add the ssh key to our github account and test our connecting usingssh -T git@github.com.Setup remote repositoryFirst we make sure we've made our first commit adding every new change:git add --all  
git commit -m "Initial commit"Next we got to our github account and create a new private repository.After that, we configure the remote repository usinggit remote add origin git@github.com/username/firefox-files.git.Then if everything went well, we can just push to our remote repository usinggit push -u origin main.We can keep this up-to-date regularly by runningcopy-to run firefox-profiles,cd C:/Users/username/firefox-filesandgit pushwhenever we make changes.Now, if we ever need to freshly install firefox, we have a backup ready to go that we can use byrunningcopy-to run-reverse.  Or, if we ever decide to use a different operating system, we copy over the copy-to confs.json (at default located atC:/Users/username/.config/copy-to/confs.json), clone our repository after installing firefox and relocate the firefox profile folder, then run:copy-to --file confs.json reset-destination firefox-profiles "new-profile-folder"  
copy-to --file confs.json run-reverse firefox-profilesOther commandsList configured paths and files withcopy-to list myname/mygroupname/all/all-no-group/groups/all-groups/names/groupnames/all-namesor as a flagcopy-to --list othercommand'all-no-group' and 'groups' to list all regular configs and groups respectively'names' and 'groupnames' to list just the regular names and groupnames respectivelyYou can also use 'all' to list/run all known configurartionsDelete set of dest/src by name withcopy-to delete myname1 (myname2)Add sources withcopy-to add-source myname folder1 file1Delete source by index withcopy-to delete-source myname 1 4 7Reset source and destination folderscopy-to reset-source myname
copy-to reset-destination myname newDestGroups are based on names. For copying to multiple directories in one go.Groupnames 'group'/'all' cannot be used.Add groupnamecopy-to add-group mygroupname myname1 myname2Delete groupnamecopy-to delete-group mygroupnameAdd name to groupcopy-to add-to-group mygroupname myname1 myname2Delete name from groupcopy-to delete-from-group mygroupname myname1 myname2At default the configuration file is located at~/.config/copy-to/confs.json, but you can set a environment variableCOPY_TOto change this, or pass a-f, --fileflag.Mac not tested