示例#1
0
def main():
    """cmdline entry point"""
    from annexremote import Master
    master = Master()
    remote = RIARemote(master)
    master.LinkRemote(remote)
    master.Listen()
示例#2
0
def main():
    output = sys.stdout
    sys.stdout = sys.stderr

    master = Master(output)
    remote = ManyZips(master)
    master.LinkRemote(remote)
    master.Listen()
def main():
    signal.signal(signal.SIGTERM, _shutdown)
    signal.signal(signal.SIGINT, _shutdown)
    if len(sys.argv) > 1:
        parser = argparse.ArgumentParser()
        subparsers = parser.add_subparsers(dest='subcommand')

        parser_version = subparsers.add_parser(
            'version',
            help='Show version of {} and relevant libraries'.format(__name__))

        parser_setup = subparsers.add_parser(
            'setup',
            help=
            'Authenticate with Google to prepare for initremote/enableremote')
        parser_setup.add_argument(
            '--client-secret',
            type=str,
            help='Provide your own client secret in JSON format'
            ' (as downloaded from https://console.developers.google.com )')
        try:
            default_token_file = _get_token_path()
            help_string = "Default: {}".format(default_token_file)
            help_string += " (Required when not run inside a git repository)"
            token_required = False
        except git.exc.InvalidGitRepositoryError:
            default_token_file = None
            help_string = "Required, because not running inside git repository."
            token_required = True

        parser_setup.add_argument(
            '-o',
            '--output',
            type=str,
            default=default_token_file,
            required=token_required,
            help='Where to store the auth token. {}'.format(help_string))

        args = parser.parse_args()
        if args.subcommand == 'setup':
            setup(args.output, gauth_file=args.client_secret)
            return
        elif args.subcommand == 'version':
            print(MODULENAME, __version__)
            print("Using AnnexRemote", annexremote_version)
            print("Using drivelib", drivelib_version)
            return

    output = sys.stdout
    sys.stdout = sys.stderr

    master = Master(output)
    master.LinkRemote(GoogleRemote(master))
    master.Listen()
示例#4
0
def _main(args, cls):
    """Unprotected portion"""
    assert(cls is not None)
    from annexremote import Master
    master = Master()
    remote = cls(master)
    master.LinkRemote(remote)
    master.Listen()
    # cleanup
    if hasattr(remote, 'stop'):
        remote.stop()
示例#5
0
def main():
    master = Master()
    remote = OSFRemote(master)
    master.LinkRemote(remote)
    master.Listen()