nushell/crates/nu-command/src
Solomon 071faae772
fix inspect and explore panics on empty records (#13893)
# Description

Fixes a couple panics:

```
> {} | inspect
Error:   x Main thread panicked.
  |-> at crates/nu-command/src/debug/inspect_table.rs:87:15
  `-> attempt to divide by zero
```

```
> {} | explore
# see an empty column, press Down
Error:   x Main thread panicked.
  |-> at crates/nu-explore/src/views/cursor/mod.rs:39:9
  `-> attempt to subtract with overflow
```

# User-Facing Changes

`{} | inspect` now outputs an empty table:

```
╭─────────────┬────────╮
│ description │ record │
├─────────────┴────────┤
│                      │
├──────────────────────┤
```

`{} | explore` opens the help menu.

Both match the empty list behavior.

# Tests

I'm not sure how to test `explore`, as it waits for interaction.
2024-09-25 07:48:16 -05:00
..
bytes Change the usage misnomer to "description" (#13598) 2024-08-22 12:02:08 +02:00
charting doc: fix broken doc links (#13644) 2024-08-23 21:17:44 +02:00
conversions Add search terms to into value (#13890) 2024-09-23 07:55:58 -05:00
database Change the usage misnomer to "description" (#13598) 2024-08-22 12:02:08 +02:00
date Change the usage misnomer to "description" (#13598) 2024-08-22 12:02:08 +02:00
debug fix inspect and explore panics on empty records (#13893) 2024-09-25 07:48:16 -05:00
env Change the usage misnomer to "description" (#13598) 2024-08-22 12:02:08 +02:00
experimental Change the usage misnomer to "description" (#13598) 2024-08-22 12:02:08 +02:00
filesystem Add threads to the ls command in order to increase performance in some circumstances (#13836) 2024-09-24 08:40:48 -05:00
filters Fix try not working with let, etc. (#13885) 2024-09-23 06:44:25 -05:00
formats Make IR the default evaluator (#13718) 2024-09-15 14:54:38 -07:00
generators Change the usage misnomer to "description" (#13598) 2024-08-22 12:02:08 +02:00
hash add binary as input to hash commands (#13923) 2024-09-25 16:47:52 +08:00
help allow tab to be retained with find (#13848) 2024-09-14 08:51:00 -05:00
math Change the usage misnomer to "description" (#13598) 2024-08-22 12:02:08 +02:00
misc Changed category for panic and added search terms and examples (#13707) 2024-08-27 16:58:05 -07:00
network Refining error handling in http post (#13805) 2024-09-07 23:57:34 +02:00
path fix path exists on a non-directory file (#13763) 2024-09-11 12:45:39 -05:00
platform Improve #12008 UX, clear scrollback by default on clear (#13821) 2024-09-11 15:33:20 -05:00
random Change the usage misnomer to "description" (#13598) 2024-08-22 12:02:08 +02:00
removed Change the usage misnomer to "description" (#13598) 2024-08-22 12:02:08 +02:00
shells Change the usage misnomer to "description" (#13598) 2024-08-22 12:02:08 +02:00
stor Change the usage misnomer to "description" (#13598) 2024-08-22 12:02:08 +02:00
strings Add --number flag to split column (#13831) 2024-09-12 07:16:33 -05:00
system Fix try not working with let, etc. (#13885) 2024-09-23 06:44:25 -05:00
viewers remove config use_grid_icons, move to parameter of grid command (#13788) 2024-09-06 07:25:43 +08:00
default_context.rs add metadata access command (#13785) 2024-09-11 12:44:06 -05:00
example_test.rs Overhaul $in expressions (#13357) 2024-07-17 16:02:42 -05:00
lib.rs Add top-level crate documentation/READMEs (#12907) 2024-07-14 10:10:41 +02:00
progress_bar.rs Replace ExternalStream with new ByteStream type (#12774) 2024-05-16 07:11:18 -07:00
sort_utils.rs Add derive macros for FromValue and IntoValue to ease the use of Values in Rust code (#13031) 2024-06-17 16:05:11 -07:00