Allow external binary to register custom commands. (#1780)

This changeset contains everything that a separate binary needs to
register its own commands (including the new help function). It is
very possible that this commit misses other pub use exports, but
the contained ones work for our use cases so far.
This commit is contained in:
Michael Nitschinger
2020-05-14 02:35:22 +02:00
committed by GitHub
parent f5a1d2f4fb
commit e7f08cb21d
4 changed files with 17 additions and 6 deletions

View File

@ -1,5 +1,6 @@
use clap::{App, Arg};
use log::LevelFilter;
use nu_cli::{create_default_context, EnvironmentSyncer};
use std::error::Error;
use std::fs::File;
use std::io::{prelude::*, BufReader};
@ -128,7 +129,10 @@ fn main() -> Result<(), Box<dyn Error>> {
"Welcome to Nushell {} (type 'help' for more info)",
clap::crate_version!()
);
futures::executor::block_on(nu_cli::cli())?;
let mut syncer = EnvironmentSyncer::new();
let context = create_default_context(&mut syncer, true)?;
futures::executor::block_on(nu_cli::cli(syncer, context))?;
}
}