public AElfCliProgram(ScreenManager screenManager, CommandParser cmdParser, AccountManager accountManager, CertificatManager certificatManager, string host = "http://localhost:5000") { _rpcAddress = host; _port = int.Parse(host.Split(':')[2]); _screenManager = screenManager; _cmdParser = cmdParser; _accountManager = accountManager; _certificatManager = certificatManager; _loadedModules = new Dictionary <string, Module>(); _commands = new List <CliCommandDefinition>(); }
public static void Main(string[] args) { CommandParser parser = new CommandParser(); var cmdOptions = new CommandLineOptions(); Parser.Default.ParseArguments <CommandLineOptions>(args).WithNotParsed(err => { Environment.Exit(1); } ).WithParsed( result => { cmdOptions = result; }); ApplicationHelpers.SetConfigPath(cmdOptions.ConfigPath); ScreenManager screenManager = new ScreenManager(); AElfKeyStore kstore = new AElfKeyStore(ApplicationHelpers.GetDefaultConfigPath()); AccountManager accountManager = new AccountManager(kstore, screenManager); CertificatManager certificatManager = new CertificatManager(screenManager); AElfCliProgram program = new AElfCliProgram(screenManager, parser, accountManager, certificatManager, cmdOptions.ServerAddr); // Register local commands RegisterAccountCommands(program); RegisterNetworkCommands(program); program.RegisterCommand(new GetIncrementCmd()); program.RegisterCommand(new SendTransactionCmd()); program.RegisterCommand(new LoadContractAbiCmd()); program.RegisterCommand(new DeployContractCommand()); program.RegisterCommand(new GetTxResultCmd()); program.RegisterCommand(new GetGenesisContractAddressCmd()); program.RegisterCommand(new GetDeserializedResultCmd()); program.RegisterCommand(new GetBlockHeightCmd()); program.RegisterCommand(new GetBlockInfoCmd()); program.RegisterCommand(new CallReadOnlyCmd()); program.RegisterCommand(new GetMerklePathCmd()); program.RegisterCommand(new CertificateCmd()); // Start the CLI program.StartRepl(); }