#nushell-plugin #units #nu #converting #command #add #value

bin+lib nu_plugin_units

A Nushell plugin for easily converting between common units

4 releases

new 0.1.3 Nov 1, 2024
0.1.2 Aug 24, 2024
0.1.1 May 30, 2024
0.1.0 Nov 27, 2023

#64 in Value formatting

Download history 150/week @ 2024-08-18 31/week @ 2024-08-25 1/week @ 2024-09-01 24/week @ 2024-09-15 14/week @ 2024-09-22 7/week @ 2024-09-29 144/week @ 2024-10-27

144 downloads per month

GPL-3.0-only

125KB
3K SLoC

nu_plugin_units

A Nushell plugin for easily converting between common units.

Installation

  1. Clone this repository
  2. Build the target via cargo build --release
  3. Add the plugin to nushell using the following nushell command plugin add ./target/release/nu_plugin_units
  4. Reload the plugin using plugin use units

Usage

〉units -c time -u years -v 1
╭────┬──────────────┬────────────────────────╮
# │     unit     │         value          │
├────┼──────────────┼────────────────────────┤
│  0 │ centuries    │                 0.0100 │
│  1 │ days         │               365.0000 │
│  2 │ decades      │                 0.1000 │
│  3 │ hours        │              8760.0000 │
│  4 │ microseconds │    31540000000000.0000 │
│  5 │ milliseconds │       31556952000.0000 │
│  6 │ minutes      │            525600.0000 │
│  7 │ months       │                12.0000 │
│  8 │ nanoseconds  │ 31540000000000000.0000 │
│  9 │ seconds      │          31536000.0000 │
│ 10 │ weeks        │                52.1430 │
│ 11 │ years        │                 1.0000 │
╰────┴──────────────┴────────────────────────╯

You may want to consider adjusting the value of float_precision in your nushell config file.

$env.config = {
    float_precision: 4
    ...
}

Dependencies

~24–57MB
~1M SLoC