import os
from pprint import pprint

import click
from googleapiclient.errors import HttpError

import gdsync.google.sync


class Cli:
    def main(self):
        try:
            self._sync()
        except HttpError as error:
            self._error(error)

    def _sync(self):
        sync = gdsync.google.sync.Sync(
            self.source,
            self.destination,
            config_dir=self.config_dir,
        )
        sync.callback = self._print
        sync.sync()

    def _error(self, error):
        print(error.uri)
        pprint(error.resp)
        raise error

    def _print(self, src_item, folder_name, state=''):
        name = os.path.join(folder_name, src_item.name)
        if src_item.is_folder():
            name += '/'

        print('%s: %s' % (state, name))


@click.command()
@click.option(
    '--config-dir',
    default=os.path.join(os.path.expanduser('~'), '.gdsync'),
    help='config directory',
)
@click.argument('source')
@click.argument('destination')
def main(source, destination, config_dir):
    cli = Cli()
    cli.source = source
    cli.destination = destination
    cli.config_dir = config_dir
    cli.main()


if __name__ == "__main__":
    main()

@@ -409,16 +409,50 @@
 ig_dir,%0A
+            sync_id=self.sync_id,%0A
         
@@ -453,16 +453,16 @@
       )%0A
-
         
@@ -840,16 +840,73 @@
 mmand()%0A
+@click.argument('source')%0A@click.argument('destination')%0A
 @click.o
@@ -1036,50 +1036,57 @@
 ick.
-argument('source')%0A@click.argument('destin
+option('--sync-id', help='unique id for syncroniz
 atio
@@ -1129,16 +1129,25 @@
 nfig_dir
+, sync_id
 ):%0A    c
@@ -1215,16 +1215,16 @@
 ination%0A
-
     cli.
@@ -1247,16 +1247,42 @@
 fig_dir%0A
+    cli.sync_id = sync_id%0A
     cli.

add option sync-id