mirror of
https://github.com/nushell/nushell
synced 2024-12-28 22:13:10 +00:00
Use enginep style in enter command (#3469)
This commit is contained in:
parent
21ef3895b3
commit
bcbdc33049
1 changed files with 4 additions and 7 deletions
|
@ -11,12 +11,6 @@ use std::path::PathBuf;
|
||||||
|
|
||||||
pub struct Enter;
|
pub struct Enter;
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
|
||||||
pub struct EnterArgs {
|
|
||||||
location: Tagged<PathBuf>,
|
|
||||||
encoding: Option<Tagged<String>>,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl WholeStreamCommand for Enter {
|
impl WholeStreamCommand for Enter {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"enter"
|
"enter"
|
||||||
|
@ -80,7 +74,10 @@ fn enter(args: CommandArgs) -> Result<ActionStream, ShellError> {
|
||||||
let context = args.context.clone();
|
let context = args.context.clone();
|
||||||
let scope = args.scope().clone();
|
let scope = args.scope().clone();
|
||||||
let path = args.context.shell_manager.path();
|
let path = args.context.shell_manager.path();
|
||||||
let (EnterArgs { location, encoding }, _) = args.process()?;
|
let args = args.evaluate_once()?;
|
||||||
|
|
||||||
|
let location: Tagged<PathBuf> = args.req(0)?;
|
||||||
|
let encoding: Option<Tagged<String>> = args.get_flag("encoding")?;
|
||||||
let location_string = location.display().to_string();
|
let location_string = location.display().to_string();
|
||||||
|
|
||||||
if location.is_dir() {
|
if location.is_dir() {
|
||||||
|
|
Loading…
Reference in a new issue