|
|
@ -11,8 +11,13 @@ impl Call for Ls {
|
|
|
|
let cwd = env::current_dir()?;
|
|
|
|
let cwd = env::current_dir()?;
|
|
|
|
let dir = fs::read_dir(&cwd)?;
|
|
|
|
let dir = fs::read_dir(&cwd)?;
|
|
|
|
for child in dir {
|
|
|
|
for child in dir {
|
|
|
|
let child = child?;
|
|
|
|
let child_path = child?.path();
|
|
|
|
_ = write!(ctx.stdout, "{}\n", child.path().display());
|
|
|
|
let fname = child_path
|
|
|
|
|
|
|
|
.file_name()
|
|
|
|
|
|
|
|
.ok_or_else(|| ExecError::new("no file name"))?
|
|
|
|
|
|
|
|
.to_str()
|
|
|
|
|
|
|
|
.ok_or_else(|| ExecError::new("non-unicode file name"))?;
|
|
|
|
|
|
|
|
_ = write!(ctx.stdout, "{}\n", fname);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Ok(Value::None)
|
|
|
|
Ok(Value::None)
|
|
|
|
}
|
|
|
|
}
|
|
|
|