mirror of
https://github.com/nushell/nushell
synced 2025-01-13 21:55:07 +00:00
Make login.nu work when using nu as a login shell (#6134)
* Make login.nu work when using nu as a login shell Fixes #6055 Signed-off-by: nibon7 <nibon7@163.com> * fix clippy warning Signed-off-by: nibon7 <nibon7@163.com>
This commit is contained in:
parent
6b4e577032
commit
b2c466bca6
1 changed files with 9 additions and 1 deletions
10
src/main.rs
10
src/main.rs
|
@ -92,7 +92,9 @@ fn main() -> Result<()> {
|
|||
// Would be nice if we had a way to parse this. The first flags we see will be going to nushell
|
||||
// then it'll be the script name
|
||||
// then the args to the script
|
||||
let mut args = std::env::args().skip(1);
|
||||
let mut args = std::env::args();
|
||||
let argv0 = args.next();
|
||||
|
||||
while let Some(arg) = args.next() {
|
||||
if !script_name.is_empty() {
|
||||
args_to_script.push(escape_for_script_arg(&arg));
|
||||
|
@ -122,6 +124,12 @@ fn main() -> Result<()> {
|
|||
|
||||
args_to_nushell.insert(0, "nu".into());
|
||||
|
||||
if let Some(argv0) = argv0 {
|
||||
if argv0.starts_with('-') {
|
||||
args_to_nushell.push("--login".into());
|
||||
}
|
||||
}
|
||||
|
||||
let nushell_commandline_args = args_to_nushell.join(" ");
|
||||
|
||||
let parsed_nu_cli_args = parse_commandline_args(&nushell_commandline_args, &mut engine_state);
|
||||
|
|
Loading…
Reference in a new issue