mirror of
https://github.com/nushell/nushell.git
synced 2024-12-28 09:59:36 +01:00
5af8d62666
# Description fixed #12699 When bare dates or naive times are specified in toml files, `from toml` returns invalid dates or times. This PR fixes the problem to correctly handle toml datetime. The current version command returns the default datetime (`chrono::DateTime::default()`) if the datetime parse fails. However, I felt that this behavior was a bit unfriendly, so I changed it to return `Value::string`. # User-Facing Changes The command returns a date with default time and timezone if a bare date is specified. ``` ~/Development/nushell> "dob = 2023-05-27" | from toml ╭─────┬────────────╮ │ dob │ a year ago │ ╰─────┴────────────╯ ~/Development/nushell> "dob = 2023-05-27" | from toml | Sat, 27 May 2023 00:00:00 +0000 (a year ago) ~/Development/nushell> ``` If a bare time is given, a time string is returned. ``` ~/Development/nushell> "tm = 11:00:00" | from toml ╭────┬──────────╮ │ tm │ 11:00:00 │ ╰────┴──────────╯ ~/Development/nushell> "tm = 11:00:00" | from toml | get tm 11:00:00 ~/Development/nushell> ``` # Tests + Formatting When I ran tests, `commands::touch::change_file_mtime_to_reference` failed with the following error. The error also occurs in the master branch, so it's probably unrelated to these changes. (maybe a problem with my dev environment) ``` $ ~/Development/nushell> toolkit check pr ~~~~~~~~ test usage_start_uppercase ... ok test format_conversions::yaml::convert_dict_to_yaml_with_integer_floats_key ... ok test format_conversions::yaml::convert_dict_to_yaml_with_boolean_key ... ok test format_conversions::yaml::table_to_yaml_text_and_from_yaml_text_back_into_table ... ok test quickcheck_parse ... ok test format_conversions::yaml::convert_dict_to_yaml_with_integer_key ... ok failures: ---- commands::touch::change_file_mtime_to_reference stdout ---- === stderr thread 'commands::touch::change_file_mtime_to_reference' panicked at crates/nu-command/tests/commands/touch.rs:298:9: assertion `left == right` failed left: SystemTime { tv_sec: 1720344745, tv_nsec: 862392750 } right: SystemTime { tv_sec: 1720344745, tv_nsec: 887670417 } failures: commands::touch::change_file_mtime_to_reference test result: FAILED. 1542 passed; 1 failed; 32 ignored; 0 measured; 0 filtered out; finished in 12.04s error: test failed, to rerun pass `-p nu-command --test main` - 🟢 `toolkit fmt` - 🟢 `toolkit clippy` - 🔴 `toolkit test` - ⚫ `toolkit test stdlib` ~/Development/nushell> toolkit test stdlib Compiling nu v0.95.1 (/Users/hiroki/Development/nushell) Compiling nu-cmd-lang v0.95.1 (/Users/hiroki/Development/nushell/crates/nu-cmd-lang) Finished dev [unoptimized + debuginfo] target(s) in 6.64s Running `target/debug/nu --no-config-file -c ' use crates/nu-std/testing.nu testing run-tests --path crates/nu-std '` 2024-07-07T19:00:20.423|INF|Running from_jsonl_invalid_object in module test_formats 2024-07-07T19:00:20.436|INF|Running env_log-prefix in module test_logger_env ~~~~~~~~~~~ 2024-07-07T19:00:22.196|INF|Running debug_short in module test_basic_commands ~/Development/nushell> ``` # After Submitting nothing |
||
---|---|---|
.. | ||
nu_plugin_custom_values | ||
nu_plugin_example | ||
nu_plugin_formats | ||
nu_plugin_gstat | ||
nu_plugin_inc | ||
nu_plugin_nu_example | ||
nu_plugin_polars | ||
nu_plugin_python | ||
nu_plugin_query | ||
nu_plugin_stress_internals | ||
nu-cli | ||
nu-cmd-base | ||
nu-cmd-extra | ||
nu-cmd-lang | ||
nu-cmd-plugin | ||
nu-color-config | ||
nu-command | ||
nu-derive-value | ||
nu-engine | ||
nu-explore | ||
nu-glob | ||
nu-json | ||
nu-lsp | ||
nu-parser | ||
nu-path | ||
nu-plugin | ||
nu-plugin-core | ||
nu-plugin-engine | ||
nu-plugin-protocol | ||
nu-plugin-test-support | ||
nu-pretty-hex | ||
nu-protocol | ||
nu-std | ||
nu-system | ||
nu-table | ||
nu-term-grid | ||
nu-test-support | ||
nu-utils | ||
nuon | ||
README.md |
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.