#!/usr/bin/env perl

# Thin wrapper: everything, including error reporting and the exit code,
# lives in App::FileSync::CLI so it can be tested without a subprocess.

use strict;
use warnings;
use autodie qw(:all);

use FindBin qw($Bin);

# A checkout's lib/ first, so bin/ runs the code beside it; an installed
# copy finds the modules on @INC as usual.
use lib "$Bin/../lib";

use App::FileSync::Platform;
use App::FileSync::CLI;

exit App::FileSync::CLI::run_client(@ARGV);

__END__

=head1 NAME

filesync - keep a directory in step with a master copy

=head1 SYNOPSIS

	filesync sync --repo docs

Run C<filesync help> for the full usage.

=head1 DESCRIPTION

See L<App::FileSync::CLI> and L<App::FileSync>.

=head1 OPTIONS

C<filesync sync> takes these options; C<filesync help> lists the options of
the other commands.

=over 4

=item --repo NAME

Sync this repo. Repeat it to sync several. Without it every repo in the
client configuration is synced.

=item --dry-run

Print the planned actions without changing either side.

=item --force

Proceed despite the deletion limits that normally stop a suspicious run.

=item --no-prune

Do not prune this repo's local trash during the run.

=item --no-delta

Send whole files instead of block deltas.

=item --verbose

Raise the log level to C<debug> for this run.

=item --quiet

Lower the log level to C<error> and hide warnings. A repo where the sync did
something still prints its summary; a repo where nothing happened (nothing
planned, moved, deleted, conflicted or skipped, and no bytes sent) prints
nothing, so a cron job that finds nothing to do is silent.

=item --json

Print one JSON document instead of text.

=item --config FILE

Read the client configuration from FILE.

=back

=head1 EXIT STATUS

0 ok, 1 fatal error, 2 another run holds the lock, 3 completed with
warnings, 4 verification found drift.  When several repos are synced the
most severe outcome wins: 1, then 3, then 2.

=head1 AUTHOR

Nigel Horne, C<< <njh at nigelhorne.com> >>

=head1 LICENCE AND COPYRIGHT

Copyright 2026 Nigel Horne.

Usage is subject to the GPL2 licence terms.
If you use it,
please let me know.

=cut
