<commit_before>#!/usr/local/bin/node
var app=require('commander'), letiny=require('./client'), examples=[
  'letiny -e <EMAIL> -w /var/www/example.com -d example.com --agree',
  'letiny -e <EMAIL> -m -d example.com -c cert.pem -k key.pem -i ca.pem --agree',
  'letiny -e <EMAIL> -m -d example.com,www.example.com --agree',
  'letiny --email <EMAIL> --webroot ./ --domains example.com --agree'
];

app
  .option('-e, --email <email>', 'your email address')
  .option('-w, --webroot <path>', 'path for webroot verification OR')
  .option('-m, --manual', 'use manual verification')
  .option('-d, --domains <domains>', 'domains (comma seperated)')
  .option('-c, --cert <path>', 'path to save your certificate (cert.pem)')
  .option('-k, --key <path>', 'path to save your private key (privkey.pem)')
  .option('-i, --ca <path>', 'path to save issuer certificate (cacert.pem)')
  .option('-a, --account <path>', 'path of the account key (optional)')
  .option('--pfx <path>', 'path to save PKCS#12 certificate (optional)')
  .option('--password <password>', 'password for PKCS#12 certificate (optional)')
  .option('--aes', 'use AES instead of 3DES for PKCS#12')
  .option('--agree', 'agree terms of the ACME CA (required)')
  .option('--newreg <URL>', 'optional AMCE server newReg URL')
  .option('--debug', 'print debug information')
  .on('--help', function() {
    console.log('  Examples:\n\n   '+examples.join('\n   ')+'\n');
  })
  .parse(process.argv);

if (app.rawArgs.length<=2) {
  return app.parse(['', '', '-h']);
} else if (!app.webroot && !app.manual) {
  return console.log('Error: You need to use "--manual" or "--webroot <path>"');
} else if (!app.domains) {
  return console.log('Error: You need to specify "--domains <domain>"');
} else if (!app.email) {
  return console.log('Error: You need to specify your "--email <address>"');
} else if (!app.agree) {
  return console.log('Error: You need to "--agree" the terms');
}

console.log('Generating keys and requesting certificate...');

letiny.getCert({
  email:app.email,
  domains:app.domains,
  webroot:app.webroot,
  challenge:manualVerification,
  certFile:app.cert || (app.pfx ? false : 'cert.pem'),
  keyFile:app.key || (app.pfx ? false : 'privkey.pem'),
  caFile:app.ca || (app.pfx ? false : 'cacert.pem'),
  accountKey:app.account,
  pfxFile:app.pfx,<commit_msg>small cli improvements<commit_after>#!/usr/local/bin/node
var app=require('commander'), letiny=require('./client'), examples=[
  'letiny -e <EMAIL> -w /var/www/example.com -d example.com --agree',
  'letiny -e <EMAIL> -m -d example.com -c cert.pem -k key.pem -i ca.pem --agree',
  'letiny -e <EMAIL> -m -d example.com,www.example.com --agree',
  'letiny --email <EMAIL> --webroot ./ --domains example.com --agree'
];

app
  .option('-e, --email <email>', 'your email address')
  .option('-w, --webroot <path>', 'path for webroot verification OR')
  .option('-m, --manual', 'use manual verification')
  .option('-d, --domains <domains>', 'domains (comma seperated)')
  .option('-c, --cert <path>', 'path to save your certificate (cert.pem)')
  .option('-k, --key <path>', 'path to load or save your private key (privkey.pem)')
  .option('-i, --ca <path>', 'path to save issuer certificate (cacert.pem)')
  .option('-a, --account <path>', 'path to load or save account key (optional)')
  .option('--pfx <path>', 'path to save PKCS#12 certificate (optional)')
  .option('--password <password>', 'password for PKCS#12 certificate (optional)')
  .option('--aes', 'use AES instead of 3DES for PKCS#12')
  .option('--agree', 'agree terms of the ACME CA (required)')
  .option('--newreg <URL>', 'optional AMCE server newReg URL')
  .option('--debug', 'print debug information')
  .on('--help', function() {
    console.log('  Examples:\n\n   '+examples.join('\n   ')+'\n');
  })
  .parse(process.argv);

if (app.rawArgs.length<=2) {
  return app.parse(['', '', '-h']);
} else if (!app.webroot && !app.manual) {
  return console.log('Error: You need to use "--manual" or "--webroot <path>"');
} else if (!app.domains) {
  return console.log('Error: You need to specify "--domains <domain>"');
} else if (!app.email) {
  return console.log('Error: You need to specify your "--email <address>"');
} else if (!app.agree) {
  return console.log('Error: You need to "--agree" the terms');
}

console.log('Preparing keys and requesting certificate...');

letiny.getCert({
  email:app.email,
  domains:app.domains,
  webroot:app.webroot,
  challenge:manualVerification,
  certFile:app.cert || (app.pfx ? false : 'cert.pem'),
  caFile:app.ca || (app.pfx ? false : 'cacert.pem'),
  privateKey:app.key || (app.pfx ? false : 'privkey.pem'),
  accountKey:app.account,
  pfxFile:app.pfx,
{'fraction_non_alphanumeric': 0.21097405359421523, 'fraction_numerical': 0.0034028073160357296, 'mean_word_length': 3.7746192893401016, 'pattern_counts': {'":': 0, '<': 39, '<?xml version=': 0, '>': 37, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2670828', 'n_tokens_mistral': 1697, 'n_tokens_neox': 1657, 'n_words': 463}