Add Path commands (#280)

* Add Path command

* Add `path basename`

* Refactor operate into `mod`

* Add `path dirname`

* Add `path exists`

* Add `path expand`

* Remove Arc wrapper for args

* Add `path type`

* Add `path relative`

* Add `path parse`

* Add `path split`

* Add `path join`

* Fix errors after rebase

* Convert to Path in `operate`

* Fix table behavior in `path join`

* Use conditional import in `path parse`

* Fix missing cases for `path join`

* Update default_context.rs

* clippy

* Fix tests

* Fix tests

Co-authored-by: JT <547158+jntrnr@users.noreply.github.com>
Co-authored-by: JT <jonathan.d.turner@gmail.com>
This commit is contained in:
Hilmar Gústafsson
2021-12-13 02:47:14 +01:00
committed by GitHub
parent bee7ef21eb
commit 90ddb23492
15 changed files with 1594 additions and 2 deletions

View File

@ -7,7 +7,7 @@ use nu_protocol::{
use crate::To;
use super::{Date, From, Into, Math, Random, Split, Str, Url};
use super::{Date, From, Into, Math, Path, Random, Split, Str, Url};
pub fn test_examples(cmd: impl Command + 'static) {
let examples = cmd.examples();
@ -24,6 +24,7 @@ pub fn test_examples(cmd: impl Command + 'static) {
working_set.add_decl(Box::new(Random));
working_set.add_decl(Box::new(Split));
working_set.add_decl(Box::new(Math));
working_set.add_decl(Box::new(Path));
working_set.add_decl(Box::new(Date));
working_set.add_decl(Box::new(Url));