Merge pull request #173 from jonathandturner/simplify_ls

Change 'file name' => 'name'. Same for type
This commit is contained in:
Jonathan Turner 2019-07-14 17:23:29 +12:00 committed by GitHub
commit 59115a532f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View file

@ -15,7 +15,7 @@ crate fn dir_entry_dict(
) -> Result<Spanned<Value>, ShellError> { ) -> Result<Spanned<Value>, ShellError> {
let mut dict = SpannedDictBuilder::new(span); let mut dict = SpannedDictBuilder::new(span);
let filename = entry.file_name(); let filename = entry.file_name();
dict.insert("file name", Value::string(filename.to_string_lossy())); dict.insert("name", Value::string(filename.to_string_lossy()));
let metadata = entry.metadata()?; let metadata = entry.metadata()?;
@ -27,7 +27,7 @@ crate fn dir_entry_dict(
FileType::Symlink FileType::Symlink
}; };
dict.insert("file type", Value::string(format!("{:?}", kind))); dict.insert("type", Value::string(format!("{:?}", kind)));
dict.insert( dict.insert(
"readonly", "readonly",
Value::boolean(metadata.permissions().readonly()), Value::boolean(metadata.permissions().readonly()),

View file

@ -1,4 +1,4 @@
cd tests cd tests
cd dirtest cd dirtest
ls | where size > 1kb | get "file name" | trim | echo $it ls | where size > 1kb | get name | trim | echo $it
exit exit