<commit_before>/*
 * keys.js: Commands related to working with SSH keys
 *
 * (C) 2010, Nodejitsu Inc.
 *
 */

var fs = require('fs'),
    path = require('path'),
    spawn = require('child_process').spawn,
    exec = require('child_process').exec,
    common = require('flatiron').common,
    async = common.async,
    rimraf = common.rimraf,
    quill = require('../../quill');
    
var keys = exports;

keys.usage = [
  '`quill keys *` commands allow you to install and update',
  'SSH keys on target machines',
  '',
  'quill keys downloadall',
  'quill keys download',
  'quill keys hostname'
];

//
// ### function hostname (callback)
// #### @callback {function} Continuation to respond to when complete.
// Displays the hostname for the current machine.
//
keys.hostname = function (callback) {
  exec('hostname', function (err, stdout, stderr) {
    if (err) {
      return callback(err);
    }
    
    var hostname = stdout.split('\n').filter(Boolean)[0];
    quill.log.info(hostname);
    callback(null, hostname);
  });
};

//
// Usage for `quill keys hostname`.
//
keys.hostname.usage = [
  'Displays the hostname of the current machine',
  '',
  'quill keys hostname',
  'quill hostname'
];<commit_msg>[api] Stub out `quill keys downloadall` and `quill keys download <username>`<commit_after>/*
 * keys.js: Commands related to working with SSH keys
 *
 * (C) 2010, Nodejitsu Inc.
 *
 */

var fs = require('fs'),
    path = require('path'),
    spawn = require('child_process').spawn,
    exec = require('child_process').exec,
    common = require('flatiron').common,
    async = common.async,
    rimraf = common.rimraf,
    quill = require('../../quill');
    
var keys = exports;

keys.usage = [
  '`quill keys *` commands allow you to install and update',
  'SSH keys on target machines',
  '',
  'quill keys downloadall',
  'quill keys download <username>',
  'quill keys hostname'
];

//
// ### function hostname (callback)
// #### @callback {function} Continuation to respond to when complete.
// Displays the hostname for the current machine.
//
keys.hostname = function (callback) {
  exec('hostname', function (err, stdout, stderr) {
    if (err) {
      return callback(err);
    }
    
    var hostname = stdout.split('\n').filter(Boolean)[0];
    quill.log.info(hostname);
    callback(null, hostname);
  });
};

//
// Usage for `quill keys hostname`.
//
keys.hostname.usage = [
  'Displays the hostname of the current machine',
  '',
  'quill keys hostname',
  'quill hostname'
];

//
// ### function downloadall (callback)
// #### @callback {function} Continuation to respond to when complete.
// Downloads all known SSH public keys to `~/.ssh/authorized_keys`.
//
keys.downloadall = function (callback) {
  callback();
};

//
// Usage for `quill keys downloadall`.
//
keys.downloadall.usage = [
  'Downloads all known SSH public keys to `~/.ssh/authorized_keys`',
  '',
  'quill keys downloadall'
];

//
// ### function download (username, callback)
// #### @username {string} Username to download keys for.
// #### @callback {function} Continuation to respond to when complete.
// Downloads all SSH public keys for the specified `username` to `~/.ssh/authorized_keys`.
//
keys.download = function (username, callback) {
  if (!username) {
    return callback(new Error('username is required to download keys'));
  }
  
  callback();
};

//
// Usage for `quill keys download`.
//
keys.download.usage = [
  'Downloads all SSH public keys for the specified `username` to `~/.ssh/authorized_keys`',
  '',
  'quill keys download <username>'
];
{'fraction_non_alphanumeric': 0.15802745867189688, 'fraction_numerical': 0.002801905295601009, 'mean_word_length': 3.3115942028985508, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 22, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2730050', 'n_tokens_mistral': 1132, 'n_tokens_neox': 1129, 'n_words': 339}