nushell/crates/nu-command/src
Bahex 3182adb6a0
Url split query (#14211)
Addresses the following points from #14162

> - There is no built-in counterpart to url build-query for splitting a
query string

There is `from url`, which, due to naming, is a little hard to discover
and suffers from the following point

> - url parse can create records with duplicate keys
> - url parse's params should either:
>   - ~group the same keys into a list.~
> - instead of a record, be a key-value table. (table<key: string,
value: string>)

# Description

## `url split-query`

Counterpart to `url build-query`, splits a url encoded query string to
key value pairs, represented as `table<key: string, value: string>`

```
> "a=one&a=two&b=three" | url split-query
╭───┬─────┬───────╮
│ # │ key │ value │
├───┼─────┼───────┤
│ 0 │ a   │ one   │
│ 1 │ a   │ two   │
│ 2 │ b   │ three │
╰───┴─────┴───────╯
```

## `url parse`

The output's `param` field is now a table as well, mirroring the new
`url split-query`

```
> 'http://localhost?a=one&a=two&b=three' | url parse
╭──────────┬─────────────────────╮
│ scheme   │ http                │
│ username │                     │
│ password │                     │
│ host     │ localhost           │
│ port     │                     │
│ path     │ /                   │
│ query    │ a=one&a=two&b=three │
│ fragment │                     │
│          │ ╭───┬─────┬───────╮ │
│ params   │ │ # │ key │ value │ │
│          │ ├───┼─────┼───────┤ │
│          │ │ 0 │ a   │ one   │ │
│          │ │ 1 │ a   │ two   │ │
│          │ │ 2 │ b   │ three │ │
│          │ ╰───┴─────┴───────╯ │
╰──────────┴─────────────────────╯
```

# User-Facing Changes

- `url parse`'s output has the mentioned change, which is backwards
incompatible.
2024-11-06 07:35:37 -06:00
..
bytes Change the usage misnomer to "description" (#13598) 2024-08-22 12:02:08 +02:00
charting Replace raw usize IDs with new types (#13832) 2024-09-30 13:20:15 +02:00
conversions update human-date-parser conversion to use local timezone (#14266) 2024-11-06 07:14:00 -06: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 Reduce duplicate dependencies on the windows crate (#14105) 2024-10-20 23:14:11 +02:00
env Reduce duplication in history path construction (#13475) 2024-10-11 07:51:50 -05:00
experimental Change the usage misnomer to "description" (#13598) 2024-08-22 12:02:08 +02:00
filesystem no deref in touch (#14214) 2024-11-03 00:56:05 -04:00
filters support binary input in length (#14224) 2024-11-04 03:39:24 +00:00
formats Make to text line endings consistent for list (streams) (#14166) 2024-11-05 09:33:54 +01:00
generators Remove as_i64 and as_f64 (#14258) 2024-11-05 09:28:56 +01:00
hash add binary as input to hash commands (#13923) 2024-09-25 16:47:52 +08:00
help add is_const to help commands and scope commands (#14125) 2024-10-21 12:54:18 +02:00
math Change the usage misnomer to "description" (#13598) 2024-08-22 12:02:08 +02:00
misc Replace raw usize IDs with new types (#13832) 2024-09-30 13:20:15 +02:00
network Url split query (#14211) 2024-11-06 07:35:37 -06:00
path fix path exists on a non-directory file (#13763) 2024-09-11 12:45:39 -05:00
platform Drop once_cell dependency (#14198) 2024-10-29 17:33:46 +01:00
random support filesize arguments in random binary/chars (#14068) 2024-10-12 14:49:05 +08: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 feat: stor insert accepts lists (#14175) 2024-10-29 06:32:55 -05:00
strings Drop once_cell dependency (#14198) 2024-10-29 17:33:46 +01:00
system Improve comment wording in run_external.rs (#14230) 2024-11-01 18:02:25 +01:00
viewers Drop once_cell dependency (#14198) 2024-10-29 17:33:46 +01:00
default_context.rs Url split query (#14211) 2024-11-06 07:35:37 -06: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 Rework sorting and add cell path and closure comparators to sort-by (#13154) 2024-10-09 19:18:16 -07:00