controller.js
function (state, cli) {

    var name = cli['<name>'];

    var chains = Object.keys(state.state.pointers);

    if(chains.indexOf(name) > -1) {
      console.log(`Error: Chain ${name} is already known, please choose another name.`);
      process.exit();
    }

    newChain({name}, state, (err, chaindata) => {
      if(typeof chaindata === 'string') return true;
      state.state.pointers[chaindata.name] = chaindata.chainenv;
      state.state.head = chaindata.name;
      state.saveState(true);
    });
  }
function (state, cli) {

    var name = cli['<name>'];

    var chains = Object.keys(state.state.pointers);

    if(chains.indexOf(name) > -1) {
      console.log(`Error: Chain ${name} is already known, please choose another name.`);
      process.exit();
    }

    newChain({name}, state, (err, chaindata) => {
      if(typeof chaindata === 'string') return true;
      state.state.pointers[chaindata.name] = chaindata.chainenv;
      state.state.head = chaindata.name;
      state.saveState(true);
    });
  }
function ( state , cli ) { var name = cli [ '<name>' ] ; var chains = Object . keys ( state . state . pointers ) ; if ( chains . indexOf ( name ) > - 1 ) { console . log ( ` ${ name } ` ) ; process . exit ( ) ; } newChain ( { name } , state , ( err , chaindata ) => { if ( typeof chaindata === 'string' ) return true ; state . state . pointers [ chaindata . name ] = chaindata . chainenv ; state . state . head = chaindata . name ; state . saveState ( true ) ; } ) ; }
Create a new environment
Create a new environment