summaryrefslogtreecommitdiff
path: root/src/query.sh
diff options
context:
space:
mode:
Diffstat (limited to 'src/query.sh')
-rw-r--r--src/query.sh18
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
+}