Use enginep style in enter command (#3469)

This commit is contained in:
Leonhard Kipp 2021-05-22 16:27:42 +02:00 committed by GitHub
parent 21ef3895b3
commit bcbdc33049
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -11,12 +11,6 @@ use std::path::PathBuf;
pub struct Enter;
#[derive(Deserialize)]
pub struct EnterArgs {
location: Tagged<PathBuf>,
encoding: Option<Tagged<String>>,
}
impl WholeStreamCommand for Enter {
fn name(&self) -> &str {
"enter"
@ -80,7 +74,10 @@ fn enter(args: CommandArgs) -> Result<ActionStream, ShellError> {
let context = args.context.clone();
let scope = args.scope().clone();
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();
if location.is_dir() {