You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`winget upgrade` has two modes:
* No parameters (at all) lists available upgrades
* Any parameter attempts to match and upgrade a package
Much like `winget list`, `winget upgrade` prints a spinner, then a
table, and then additionally a footer.
The `winget list` completions handle output through `detect columns
--guess` and return structured data.
Presumably because `detect columns --guess` does not work on `winget
upgrade`, no output handling was done until now.
1. Split off trimLoadingSymbol as a common function between two, now
three, commands
2. Implement a separate command `winget upgrades` instead of handling
`winget upgrade` because of overloaded behavior complicating
implementation
Now, `winget upgrades` can be used to get structured data of available
upgrades, while `winget upgrade` behaves like before, without parameters
has text output, and with parameters upgrades packages.
While introducing a separate command is not strictly completions [for
external commands], this one is very close to the completions, logic,
and use cases. Keeping it close will help discovery and future
development which may integrate returning structured data into the
"normal" completions.
---
I was not able to test for “no updates” output.
---
```nushell
winget upgrades
# => ╭───┬──────────────────────────────────┬─────────────────────┬───────────────────────────────┬───────────────────────────────┬────────╮
# => │ # │ name │ id │ version │ available │ source │
# => ├───┼──────────────────────────────────┼─────────────────────┼───────────────────────────────┼───────────────────────────────┼────────┤
# => │ 0 │ Go Programming Language amd64 g… │ GoLang.Go │ 1.25.1 │ 1.25.2 │ winget │
# => ╰───┴──────────────────────────────────┴─────────────────────┴───────────────────────────────┴───────────────────────────────┴────────╯
```
name: ( $chars|slice ($cols.0.i)..($cols.1.i-1) |str join|str trim )
361
+
id: ( $chars|slice ($cols.1.i)..($cols.2.i-1) |str join|str trim )
362
+
version: ( $chars|slice ($cols.2.i)..($cols.3.i-1) |str join|str trim )
363
+
available: ( $chars|slice ($cols.3.i)..($cols.4.i-1) |str join|str trim )
364
+
source: ( $chars|slice ($cols.4.i)..|str join|str trim )
365
+
}
366
+
}
367
+
# Reject footer lines, in a best effort approach, because there is no clear separator or definitely identifiable form change.
368
+
# We expect `x upgrades available.` to follow the table. Then maybe `x package(s) have version numbers that cannot be determined. Use --include-unknown to see all results.`
0 commit comments