Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions custom-completions/winget/winget-completions.nu
Original file line number Diff line number Diff line change
Expand Up @@ -169,18 +169,16 @@ export def "winget source list" [
pos_name?: string, # Name of the source
--name(-n): string, # Name of the source
--raw, # Output the raw CLI output instead of structured data
--help(-?) # Display the help for this command
] {
let flagify = { |name, value| nu-complete winget flagify $name $value }
let params = ([
"source"
"list"
$pos_name
(do $flagify name $name)
(do $flagify help $help)
] | compact --empty)

if $raw or $help {
if $raw {
^winget ...$params
} else {
let output = (^winget ...$params | lines)
Expand Down Expand Up @@ -235,7 +233,6 @@ export def "winget search" [
--header: string, # Optional Windows-Package-Manager REST source HTTP header
--accept_source_agreements, # Accept all source agreements during source operations
--raw, # Output the raw CLI output instead of structured data
--help(-?) # Display the help for this command
] {
let flagify = { |name, value| nu-complete winget flagify $name $value }

Expand All @@ -256,15 +253,14 @@ export def "winget search" [
(do $flagify exact $exact)
(do $flagify header $header)
(do $flagify accept_source_agreements $accept_source_agreements)
(do $flagify help $help)
]
| flatten
| where { not ($in | is-empty) }
)

let output = ^winget ...$params
| nu-complete winget trimLoadingSymbol
if $raw or $help {
if $raw {
$output
} else {
let lines = ($output | detect columns --guess) | rename name id version match source
Expand Down Expand Up @@ -294,7 +290,6 @@ export def "winget list" [
--accept_source_agreements, # Accept all source agreements during source operations
--upgrade_available # Filter results by available upgrade
--raw, # Output the raw CLI output instead of structured data
--help(-?) # Display the help for this command
] {
let flagify = { |name, value| nu-complete winget flagify $name $value }

Expand All @@ -317,15 +312,14 @@ export def "winget list" [
(do $flagify header $header)
(do $flagify accept_source_agreements $accept_source_agreements)
(do $flagify upgrade-available $upgrade_available)
(do $flagify help $help)
]
| flatten
| where { not ($in | is-empty) })
)

let output = ^winget ...$params
| nu-complete winget trimLoadingSymbol
if $help or $raw {
if $raw {
$output
} else {
let lines = ($output | detect columns --guess) | rename name id version available source
Expand Down
Loading