Add: script to get imports hierarchy
This commit is contained in:
parent
667179af2a
commit
cf06d8b10c
1 changed files with 15 additions and 0 deletions
15
scripts/imports.sh
Executable file
15
scripts/imports.sh
Executable file
|
|
@ -0,0 +1,15 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
find $HOME/nixos-config -name "*.nix" | while read -r file; do
|
||||||
|
imports=$(awk '
|
||||||
|
/imports[[:space:]]*=/ {flag=1}
|
||||||
|
flag {print}
|
||||||
|
/\]/ && flag {flag=0}
|
||||||
|
' "$file" | grep -vE 'imports[[:space:]]*=' | grep -v '\[' | grep -v '\]' | sed 's/^[[:space:]]*//; s/[[:space:]]*$//')
|
||||||
|
|
||||||
|
if [[ -n "$imports" ]]; then
|
||||||
|
echo "$file imports:"
|
||||||
|
echo "$imports" | sed 's/^/ |--- /'
|
||||||
|
echo
|
||||||
|
fi
|
||||||
|
done
|
||||||
Loading…
Add table
Add a link
Reference in a new issue