nushell/crates
Darren Schroeder 4367aa9f58
allow parsing of human readable datetimes (#11051)
# Description

This PR adds the ability to parse human readable datetime strings as
part of the `into datetime` command. I added a new `-n`/`--list-human`
parameter that produces this list to give the user an idea of what is
supported.
```nushell
❯ into datetime --list-human 
╭#─┬parseable human datetime examples┬───result───╮
│0 │Today 18:30                      │in 8 hours  │
│1 │2022-11-07 13:25:30              │a year ago  │
│2 │15:20 Friday                     │in 3 days   │
│3 │This Friday 17:00                │in 3 days   │
│4 │13:25, Next Tuesday              │in a week   │
│5 │Last Friday at 19:45             │3 days ago  │
│6 │In 3 days                        │in 2 days   │
│7 │In 2 hours                       │in 2 hours  │
│8 │10 hours and 5 minutes ago       │10 hours ago│
│9 │1 years ago                      │a year ago  │
│10│A year ago                       │a year ago  │
│11│A month ago                      │a month ago │
│12│A week ago                       │a week ago  │
│13│A day ago                        │a day ago   │
│14│An hour ago                      │an hour ago │
│15│A minute ago                     │a minute ago│
│16│A second ago                     │now         │
│17│Now                              │now         │
╰#─┴parseable human datetime examples┴───result───╯
```

Or with `$env.config.datetime_format.table` set.
```nushell
❯ into datetime --list-human 
╭#─┬parseable human datetime examples┬──────result───────╮
│0 │Today 18:30                      │11/14/23 06:30:00PM│
│1 │2022-11-07 13:25:30              │11/07/22 01:25:30PM│
│2 │15:20 Friday                     │11/17/23 03:20:00PM│
│3 │This Friday 17:00                │11/17/23 05:00:00PM│
│4 │13:25, Next Tuesday              │11/21/23 01:25:00PM│
│5 │Last Friday at 19:45             │11/10/23 07:45:00PM│
│6 │In 3 days                        │11/17/23 10:12:54AM│
│7 │In 2 hours                       │11/14/23 12:12:54PM│
│8 │10 hours and 5 minutes ago       │11/14/23 12:07:54AM│
│9 │1 years ago                      │11/13/22 10:12:54AM│
│10│A year ago                       │11/13/22 10:12:54AM│
│11│A month ago                      │10/15/23 11:12:54AM│
│12│A week ago                       │11/07/23 10:12:54AM│
│13│A day ago                        │11/13/23 10:12:54AM│
│14│An hour ago                      │11/14/23 09:12:54AM│
│15│A minute ago                     │11/14/23 10:11:54AM│
│16│A second ago                     │11/14/23 10:12:53AM│
│17│Now                              │11/14/23 10:12:54AM│
╰#─┴parseable human datetime examples┴──────result───────╯
```
# User-Facing Changes
<!-- List of all changes that impact the user experience here. This
helps us keep track of breaking changes. -->

# Tests + Formatting
<!--
Don't forget to add tests that cover your changes.

Make sure you've run and fixed any issues with these commands:

- `cargo fmt --all -- --check` to check standard code formatting (`cargo
fmt --all` applies these changes)
- `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used` to
check that you're using the standard code style
- `cargo test --workspace` to check that all tests pass (on Windows make
sure to [enable developer
mode](https://learn.microsoft.com/en-us/windows/apps/get-started/developer-mode-features-and-debugging))
- `cargo run -- -c "use std testing; testing run-tests --path
crates/nu-std"` to run the tests for the standard library

> **Note**
> from `nushell` you can also use the `toolkit` as follows
> ```bash
> use toolkit.nu # or use an `env_change` hook to activate it
automatically
> toolkit check pr
> ```
-->

# After Submitting
<!-- If your PR had any user-facing changes, update [the
documentation](https://github.com/nushell/nushell.github.io) after the
PR is merged, if necessary. This will help us keep the docs up to date.
-->
2023-11-15 17:43:37 -06:00
..
nu_plugin_custom_values Bump version to 0.87.1 (#11056) 2023-11-15 23:50:11 +01:00
nu_plugin_example Bump version to 0.87.1 (#11056) 2023-11-15 23:50:11 +01:00
nu_plugin_formats Bump version to 0.87.1 (#11056) 2023-11-15 23:50:11 +01:00
nu_plugin_gstat Bump version to 0.87.1 (#11056) 2023-11-15 23:50:11 +01:00
nu_plugin_inc Bump version to 0.87.1 (#11056) 2023-11-15 23:50:11 +01:00
nu_plugin_python remove vectorize_over_list from python plugin (#9905) 2023-08-03 16:46:48 +02:00
nu_plugin_query Bump version to 0.87.1 (#11056) 2023-11-15 23:50:11 +01:00
nu-cli Bump version to 0.87.1 (#11056) 2023-11-15 23:50:11 +01:00
nu-cmd-base Bump version to 0.87.1 (#11056) 2023-11-15 23:50:11 +01:00
nu-cmd-dataframe Bump version to 0.87.1 (#11056) 2023-11-15 23:50:11 +01:00
nu-cmd-extra Bump version to 0.87.1 (#11056) 2023-11-15 23:50:11 +01:00
nu-cmd-lang Bump version to 0.87.1 (#11056) 2023-11-15 23:50:11 +01:00
nu-color-config Bump version to 0.87.1 (#11056) 2023-11-15 23:50:11 +01:00
nu-command allow parsing of human readable datetimes (#11051) 2023-11-15 17:43:37 -06:00
nu-engine Bump version to 0.87.1 (#11056) 2023-11-15 23:50:11 +01:00
nu-explore nu-table/ Add -t/theme argument && Replace -n/start-number with -i/index (#11058) 2023-11-15 17:41:18 -06:00
nu-glob Bump version to 0.87.1 (#11056) 2023-11-15 23:50:11 +01:00
nu-json Bump version to 0.87.1 (#11056) 2023-11-15 23:50:11 +01:00
nu-lsp Implement LSP Text Document Synchronization (#10941) 2023-11-15 17:35:48 -06:00
nu-parser Bump version to 0.87.1 (#11056) 2023-11-15 23:50:11 +01:00
nu-path Bump version to 0.87.1 (#11056) 2023-11-15 23:50:11 +01:00
nu-plugin Bump version to 0.87.1 (#11056) 2023-11-15 23:50:11 +01:00
nu-pretty-hex Bump version to 0.87.1 (#11056) 2023-11-15 23:50:11 +01:00
nu-protocol nu-table/ Add -t/theme argument && Replace -n/start-number with -i/index (#11058) 2023-11-15 17:41:18 -06:00
nu-std Bump version to 0.87.1 (#11056) 2023-11-15 23:50:11 +01:00
nu-system Bump version to 0.87.1 (#11056) 2023-11-15 23:50:11 +01:00
nu-table nu-table/ Add -t/theme argument && Replace -n/start-number with -i/index (#11058) 2023-11-15 17:41:18 -06:00
nu-term-grid Bump version to 0.87.1 (#11056) 2023-11-15 23:50:11 +01:00
nu-test-support Testing support tweaks: exit status in Outcome (#10692) 2023-11-15 23:50:43 +01:00
nu-utils Bump version to 0.87.1 (#11056) 2023-11-15 23:50:11 +01:00
README.md Remove old nushell/merge engine-q 2022-02-07 14:54:06 -05:00

Nushell core libraries and plugins

These sub-crates form both the foundation for Nu and a set of plugins which extend Nu with additional functionality.

Foundational libraries are split into two kinds of crates:

  • Core crates - those crates that work together to build the Nushell language engine
  • Support crates - a set of crates that support the engine with additional features like JSON support, ANSI support, and more.

Plugins are likewise also split into two types:

  • Core plugins - plugins that provide part of the default experience of Nu, including access to the system properties, processes, and web-connectivity features.
  • Extra plugins - these plugins run a wide range of different capabilities like working with different file types, charting, viewing binary data, and more.