'use strict';

var Command = require('ronin').Command;
var debug = require('debug');
var utils = require('../utils');
var log = debug('cli');
log.error = debug('cli:error');

module.exports = Command.extend({
  desc: 'Shows IPFS Node ID info',

  options: {
    format: {
      alias: 'f',
      type: 'string'
    }
  },

  run: function run(name) {
    utils.getIPFS(function (err, ipfs) {
      if (err) {
        throw err;
      }

      ipfs.id(function (err, id) {
        if (err) {
          return log.error(err);
        }
        console.log(id);
      });
    });
  }
});