Initial commit
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
--- a/share/functions/fish_command_not_found.fish
|
||||
+++ b/share/functions/fish_command_not_found.fish
|
||||
@@ -49,6 +49,44 @@
|
||||
function fish_command_not_found
|
||||
command-not-found -- $argv[1]
|
||||
end
|
||||
+ # depot can query binary repo metadata for path ownership, which lets us
|
||||
+ # suggest packages for missing commands in a pkgfile-like format.
|
||||
+else if type -q depot
|
||||
+ function fish_command_not_found
|
||||
+ set -l __depot_seen_dirs
|
||||
+ set -l __depot_paths
|
||||
+ set -l __depot_packages
|
||||
+
|
||||
+ for __dir in $PATH
|
||||
+ string match -q '/*' -- $__dir; or continue
|
||||
+ contains -- $__dir $__depot_seen_dirs; and continue
|
||||
+ set -a __depot_seen_dirs $__dir
|
||||
+ set -a __depot_paths $__dir/$argv[1]
|
||||
+ end
|
||||
+
|
||||
+ if test (count $__depot_paths) -eq 0
|
||||
+ set __depot_paths /usr/bin/$argv[1] /bin/$argv[1]
|
||||
+ end
|
||||
+
|
||||
+ for __path in $__depot_paths
|
||||
+ set -l __hits (
|
||||
+ depot repo owns $__path 2>/dev/null |
|
||||
+ string match -r '^\[INFO\] [^ ]+ \[binary:[^]]+\] [^ ]+ size=[^ ]+ owns=.*$' |
|
||||
+ string replace -r '^\[INFO\] ([^ ]+) \[binary:([^]]+)\] ([^ ]+) size=[^ ]+ owns=(.+)$' '$2/$1 $3\t$4'
|
||||
+ )
|
||||
+
|
||||
+ for __hit in $__hits
|
||||
+ contains -- $__hit $__depot_packages; or set -a __depot_packages $__hit
|
||||
+ end
|
||||
+ end
|
||||
+
|
||||
+ if test (count $__depot_packages) -gt 0
|
||||
+ printf "%s may be found in the following packages:\n" "$argv[1]"
|
||||
+ printf " %s\n" $__depot_packages
|
||||
+ else
|
||||
+ __fish_default_command_not_found_handler $argv[1]
|
||||
+ end
|
||||
+ end
|
||||
# pkgfile is an optional, but official, package on Arch Linux
|
||||
# it ships with example handlers for bash and zsh, so we'll follow that format
|
||||
else if type -q pkgfile
|
||||
@@ -0,0 +1,55 @@
|
||||
[build]
|
||||
type = "cmake"
|
||||
|
||||
[build.flags]
|
||||
build_dir = "build"
|
||||
configure = [
|
||||
"-DWITH_DOCS=ON",
|
||||
"-DFISH_USE_SYSTEM_PCRE2=ON",
|
||||
"-DWITH_MESSAGE_LOCALIZATION=ON",
|
||||
"-Wno-dev",
|
||||
]
|
||||
keep = [ "etc/fish/config.fish" ]
|
||||
use_lto = false
|
||||
|
||||
[dependencies]
|
||||
build = [
|
||||
"cmake",
|
||||
"jq",
|
||||
"rust",
|
||||
"python-sphinx",
|
||||
]
|
||||
optional = [
|
||||
"python",
|
||||
"groff",
|
||||
"mandoc",
|
||||
"xsel",
|
||||
"xclip",
|
||||
"wl-clipboard",
|
||||
]
|
||||
runtime = [
|
||||
"glibc",
|
||||
"libunwind",
|
||||
"pcre2",
|
||||
]
|
||||
test = [
|
||||
"expect",
|
||||
"procps-ng",
|
||||
"python-pexpect",
|
||||
]
|
||||
|
||||
[package]
|
||||
description = "Smart and user friendly shell intended mostly for interactive use"
|
||||
homepage = "https://fishshell.com/"
|
||||
license = "GPL-2.0-only AND BSD-3-Clause AND ISC AND MIT AND PSF-2.0"
|
||||
name = "fish"
|
||||
version = "4.5.0"
|
||||
revision = 2
|
||||
|
||||
[[source]]
|
||||
extract_dir = "$name-$version"
|
||||
url = "https://github.com/fish-shell/fish-shell#$version"
|
||||
patches = [ "fish-4.5.0-depot-command-not-found.patch" ]
|
||||
|
||||
[[manual_sources]]
|
||||
files = [ "fish-4.5.0-depot-command-not-found.patch", "postinstall.sh", "postupdate.sh", "postremove.sh" ]
|
||||
@@ -0,0 +1,2 @@
|
||||
grep -qe '^/usr/bin/fish$' etc/shells || echo '/usr/bin/fish' >> etc/shells
|
||||
grep -qe '^/bin/fish$' etc/shells || echo '/bin/fish' >> etc/shells
|
||||
@@ -0,0 +1 @@
|
||||
sed -ri -e '\|^/usr/bin/fish$|d' -e '\|^/bin/fish$|d' etc/shells
|
||||
@@ -0,0 +1,2 @@
|
||||
grep -qe '^/usr/bin/fish$' etc/shells || echo '/usr/bin/fish' >> etc/shells
|
||||
grep -qe '^/bin/fish$' etc/shells || echo '/bin/fish' >> etc/shells
|
||||
Reference in New Issue
Block a user