diff options
author | davidovski <david@davidovski.xyz> | 2022-02-20 02:45:55 +0000 |
---|---|---|
committer | davidovski <david@davidovski.xyz> | 2022-02-20 02:45:55 +0000 |
commit | 8f02115e50573be0a5c6653f2a4a2bb6d7459911 (patch) | |
tree | c1c8fb3335bf9f940abd6aae8b2713e4443319db /src/query.sh | |
parent | e5bc87ffc368799685b9c9bf0e01db35ee974540 (diff) |
added file lookup
Diffstat (limited to 'src/query.sh')
-rw-r--r-- | src/query.sh | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/query.sh b/src/query.sh index 7e66b7c..0697005 100644 --- a/src/query.sh +++ b/src/query.sh @@ -3,3 +3,21 @@ search () { find ${PACKAGES_DIR} -type f | sed "s,${PACKAGES_DIR}/,," | grep$(echo $@ | sed "s/ /\\|/g") } + +files () { + for package in $@; do + local file="${INSTALLED_DIR}/$package/files" + [ -f $file ] && cat $file || >&2 printf "${RED}Package ${LIGHT_RED}$package${RED} is not installed" + done +} + +file () { + for file in $@; do + [ ! -f ${SYSROOT}$file ] && file=$(realpath $file) + for list in ${INSTALLED_DIR}/*/files; do + package=$(dirname $list | xargs basename) + grep -q $file $list && + printf "${LIGHT_BLUE}%s${BLUE} belongs to ${LIGHT_BLUE}%s${RESET}\n" $file $package + done + done +} |