Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(scoop-completions): correct substring indices to properly trim .ps1 extension #1056

Merged
merged 5 commits into from
Feb 24, 2025
Merged
Changes from 2 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
6 changes: 3 additions & 3 deletions custom-completions/scoop/scoop-completions.nu
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ def scoopAllApps [] {
} else {
[ $env.USERPROFILE, 'scoop', 'buckets' ] | path join
}
(ls -s $bucketsDir | get name) | each {|bucket| ls ([$bucketsDir, $bucket, 'bucket', '*.json'] | path join ) | get name | path basename | str substring ..-5} | flatten | uniq
(ls -s $bucketsDir | get name) | each {|bucket| ls ([$bucketsDir, $bucket, 'bucket'] | path join ) | get name | path parse | where extension == json | get stem } | flatten | uniq
}

# list of all apps that are not installed
def scoopAvailableApps [] {
let all = (scoopAllApps)
let installed = (scoopInstalledApps)

$all | where not $it in $installed
$all | where not ($it in $installed)
}

# list of all config options
Expand Down Expand Up @@ -117,7 +117,7 @@ def scoopCommands [] {
[value, description];
[
# eg. scoop-help.ps1 -> help
($command.name | path basename | str substring 6..-4),
($command.name | path parse | get stem |str substring 6..),
# second line is starts with '# Summary: '
# eg. '# Summary: Install apps' -> 'Install apps'
(open $command.name | lines | skip 1 | first | str substring 11..)
Expand Down