'Implements interface.'

def add_config(self, options, script):

    if (not options.appengine_account_project):
        return
    script.append('hal    -q    --log=info    config    provider    appengine    enable')
    account_params = [options.appengine_account_name, '--project', options.appengine_account_project]
    if options.appengine_account_credentials:
        account_params.extend(['--json-path', os.path.basename(options.appengine_account_credentials)])
    if options.appengine_account_local_repository_directory:
        account_params.extend(['--local-repository-directory', options.appengine_account_local_repository_directory])
    script.append('hal    -q    --log=info    config    provider    appengine    account    add    {params}'.format(params='    '.join(account_params)))
    hal_edit = 'hal    -q    --log=info    config    provider    appengine    account    edit    {name}'.format(name=options.appengine_account_name)
    if options.appengine_account_git_username:
        git_params = ['--git-https-username', options.appengine_account_git_username]
        if options.appengine_account_git_oauth_credentials:
            git_params.append('--github-oauth-access-token    <    {file}'.format(file=os.path.basename(options.appengine_account_git_oauth_credentials)))
        elif options.appengine_account_git_https_credentials:
            git_params.append('--git-https-password    <    {path}'.format(path=os.path.basename(options.appengine_account_git_https_credentials)))
        script.append('{hal}    {params}'.format(hal=hal_edit, params='    '.join(git_params)))
    if options.appengine_account_ssh_private_key_path:
        ssh_params = ['--ssh-private-key-file-path', options.appengine_account_local_repository_directory]
        if options.appengine_account_ssh_private_key_passphrase:
            ssh_params.append('--ssh-private-key-passphrase    <    {path}'.format(path=os.path.basename(options.appengine_account_ssh_private_key_passphrase)))
        script.append('{hal}    {params}'.format(hal=hal_edit, params='    '.join(ssh_params)))
