Make Nu bootstrap itself from main. (#3619)

We've relied on `clap` for building our cli app bootstrapping that figures out the positionals, flags, and other convenient facilities. Nu has been capable of solving this problem for quite some time. Given this and much more reasons (including the build time caused by `clap`) we start here working with our own.
This commit is contained in:
Andrés N. Robalino
2021-06-15 17:43:25 -05:00
committed by GitHub
parent ec96e85d04
commit 7c7e5112ea
16 changed files with 852 additions and 272 deletions

View File

@ -153,8 +153,7 @@ impl EvaluationContext {
}
}
#[allow(unused)]
pub(crate) fn get_command(&self, name: &str) -> Option<Command> {
pub fn get_command(&self, name: &str) -> Option<Command> {
self.scope.get_command(name)
}
@ -162,7 +161,7 @@ impl EvaluationContext {
self.scope.has_command(name)
}
pub(crate) fn run_command(
pub fn run_command(
&self,
command: Command,
name_tag: Tag,

View File

@ -265,11 +265,11 @@ pub fn run_script_standalone(
redirect_stdin: bool,
context: &EvaluationContext,
exit_on_error: bool,
) -> Result<(), Box<dyn Error>> {
) -> Result<(), ShellError> {
context
.shell_manager()
.enter_script_mode()
.map_err(Box::new)?;
.map_err(ShellError::from)?;
let line = process_script(&script_text, context, redirect_stdin, 0, false);
match line {