The script was revised: - https://build.opensuse.org/package/rdiff/home:qkzhu:branches:GNOME:Factory/gobject-introspection?linkrev=base&rev=2 And I tested this script against gnome-shell, gnome-shell-extensions, gjs via: #!/bin/bash files=$(find ~/git/gnome-shell-extensions -name "*.js") #files=$(find ~/git/gjs -name "*.js") #files=$(find ~/git/gnome-shell -name "*.js") for file in $files do echo "the requires of $file"; grep -r -h -A2 'const {' $file | paste -s -d ' ' | grep '} = imports.gi;' | sed 's/imports.gi;.*/imports.gi;/' | awk -F '[{}]' '{print $(NF>1?NF-1:"")}' | tr ',' '\n' | tr -d ' ' echo "----------" done