using Popen causes the command to return before making the connection so
the closing of the master connection (in runners) happens before we had
time to log into the server forcing us to complete an extra login step.
unisync_add was missing synchronisation steps that allow to
synchronise a new file (present on the server but as a link locally).
This adds the two necessary synchronisations, the first one so all the
files are up to date and are not overwritten by the second one which
forces all the changes from the remote to overwrite the local ones. This
has the effect to replace the link with the actual file.
Moves the backup options from sync_files to init.
The options are needed in links (to ignore the backup folders)
so it is way easier to have them as attributes.
To do this we move everything related to backup into __init__.
Also remove the option from the runner.
Append was used instead of extend which made a list inside of a list
instead of appending the content at the end fix that.
Convert backup.maxbackups to str as needed for subprocess.
Use the del keyword for unused functions arguments in runners.
All the runners must have the same signature however some do not use
all of the provided arguments so we delete them so the developement
tools do not generate warnings.
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