Adds the option to enable backup when synchronising.
This is done in sync_files by passing the appropriate arguments to sync.
For this we need to add an argument to sync_files as the backup
configuration options are needed.
The configuration options are imported from unisync.config.BackupConfig.
Also import typing.cast to be able to narrow down a type.
Add the option to give arbitrary arguments to the unison call.
These arguments must be passed as a list to sync and will be given to
unison as is.
This is a prerequisite for using the backup system of unison as the
arguments for backup will only be given when synchronising the files and
not the links.
DEFAULT_MISC_CACHE_DIR_PATH was a Path but the fallbacks of config.get
in config.py will be converted to a string so make it a string instead
and do the conversion later
The wrong function was call in the sync runner (update_links instead of
sync_links) which mean the links were updated remotly but never
synchronised with the local.
Call sync_links instead.
We keep the call to update_links but set it to be in background.
Remove the defaults from the dataclasses as they are redundent with the
fallbacks of configparser.
Use the values in defaults.py as the fallbacks instead of hardcoded
values.
Creates the file defaults.py this is used to store the defaults and
easily include them into the config.
Changing defaults is thus possible without touching the code leaving
less room for errors.
Multiple changes to the main file, after this unisync becomes kind of
usable.
Add subcommands : this uses the 2 previous commits to add the
subcommands to unisync it is now possible to sync, add and mount.
pathlib : move from PosixPath to Path
Remove unused imports
Rename base_namespace to cli_args
Add some comments and TODOs
this adds subcommands to the argparser using subparsers, we also set a
default value for func depending on which of the subcommands is
selected.
Also change the formatting of the epilog so it is on two lines.
This adds runners.py, it contains a set of functions that peform all the
various task that unisync can do (sync, add and mount for now).
They are simple function that put together all the rest.
Fix :
- paths : true instead of True
- paths : Path has no len convert to str first to get the number of
characters
Improvements :
- Replace all PosixPath by Path
Adds functions that allows adding new paths to the synchronisation.
When writing the new paths to the file if a parent directory is
synchronised all the childrens are removed.
This creates a new optionnal category in the config called other that is
used to configure various aspects of unison.
Currently it only allows to customise the path to the cache directory
which is ~/.unisync by default
This refactors the paths functions in a class called PathsManager
allowing to share some data like the Paths to the various directories
unisync works with.
This commit also creates the get_paths_to_sync method which simply reads
the paths file and returns its content as a list
Adds the mount_remote_dir method to the synchroniser, this allows to
mount the remote directory in order to access it with the generated
links.
Also adds the background parameter to the documentation of update_links
The paths file will be used for everything related to the paths to
synchronise.
Adds the user_select_files functions that allows the user to select
paths