import yargs from "yargs" ; import { cmds } from "./cmds" ; import { globalOptions , rcConfigOption } from "./options" ; import { registerCommandToYargs } from "./util" ; import { getVersion } from "./util/version" ; const version = getVersion ( ) ; const topBanner = `🌟 Lodestar: TypeScript Implementation of the Ethereum 2.0 Beacon Chain.
  * Version: ${ version }
  * by ChainSafe Systems, 2018-2021` ; const bottomBanner = `📖 For more information, check the CLI reference:
  * https://chainsafe.github.io/lodestar/reference/cli

✍️ Give feedback and report issues on GitHub:
  * https://github.com/ChainSafe/lodestar` ; /**
 * Common factory for running the CLI and running integration tests
 * The CLI must actually be executed in a different script
 */ export function getLodestarCli ( ) { const lodestar = yargs . env ( "LODESTAR" ) . parserConfiguration ( { "dot-notation" : false , } ) . options ( globalOptions ) . scriptName ( "" ) . demandCommand ( 1 ) . showHelpOnFail ( false ) . usage ( topBanner ) . epilogue ( bottomBanner ) . version ( topBanner ) . alias ( "h" , "help" ) . alias ( "v" , "version" ) . recommendCommands ( ) ; for ( const cmd of cmds ) { registerCommandToYargs ( lodestar , cmd ) ; } lodestar . recommendCommands ( ) . strict ( ) ; lodestar . config ( ... rcConfigOption ) ; return lodestar ; }