text: // Generated by CoffeeScript 2.6.1
  // # `nikita.file.types.ssh_authorized_keys`
  
  // Note, due to the restrictive permission imposed by sshd on the parent directory,
  // this action will not attempt to create nor modify the parent directory and will
  // throw an Error if it does not exists.
  
  // ## Schema definitions
  var definitions, handler, path, utils;
  
  definitions = {
    config: {
      type: 'object',
      properties: {
        'gid': {
          type: 'string',
          description: `File group name or group id.`
        },
        'keys': {
          type: 'array',
          description: `Array containing the public keys.`
        },
        'merge': {
          type: 'boolean',
          description: `Read the target if it exists and merge its content.`
        },
        'mode': {
          $ref: 'module://@nikitajs/file/lib/index#/definitions/config/properties/mode'
        },
        'target': {
          type: 'string',
          description: `File to write, default to "/etc/pacman.conf".`
        },
        'uid': {
          type: 'string',
          description: `File user name or user id.`
        }
      },
      required: ['target', 'keys']
    }
  };
  
  // ## Handler
  handler = async function({config}) {
    var key;
    await this.fs.assert({
      target: path.dirname(config.target)
    });
    if (config.merge) {
      return (await this.file({
        target: config.target,
        write: (function() {
          var i, len, ref, results;
          ref = config.keys;
          results = [];
          for (i = 0, len = ref.length; i < len; i++) {
            key = ref[i];
            results.push({
              match: new RegExp(`.*${utils.regexp.escape(key)}.*`, 'mg'),
              replace: key,
              append: true
            });
          }
          return results;
        })(),
        uid: config.uid,
        gid: config.gid,
        mode: config.mode,
        eof: true
      }));
    } else {
      return (await this.file({
        target: config.target,
        content: config.keys.join('\n'),
        uid: config.uid,
        gid: config.gid,
        mode: config.mode,
        eof: true
      }));
    }
  };
  
  
  // ## Exports
  module.exports = {
    handler: handler,
    metadata: {
      definitions: definitions
    }
  };
  
  // ## Dependencies
  path = require('path');
  
  utils = require('../utils');
  