Skip to content

Commit 49a3305

Browse files
committed
Add script to compute the number of files per package
1 parent a57cb4c commit 49a3305

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Prints the number of files in a package.
4+
#
5+
# <package_path> <number_of_files>
6+
7+
# Determine root directory:
8+
root="$(git rev-parse --show-toplevel)"
9+
10+
# Define the path to a utility to list packages:
11+
find_pkgs="${root}/tools/scripts/find_packages"
12+
13+
# Define the path to a utility to list files:
14+
find_files="${root}/tools/scripts/find_files"
15+
16+
# Get a list of packages:
17+
pkgs="$(PACKAGES_FILTER=${PACKAGES_FILTER} ${find_pkgs})"
18+
19+
# For each package, determine the number of files...
20+
for pkg in ${pkgs}; do
21+
# * `find_files`
22+
# - Find package files.
23+
# * `wc -l`
24+
# - Compute the number of lines.
25+
# * `awk '{}'`
26+
# - Print results.
27+
FILES_PATTERN="${FILES_PATTERN}" FILES_FILTER="$pkg/.*" "${find_files}" | wc -l | awk -v pkg="$pkg" '{ print pkg OFS $1 }'
28+
done

0 commit comments

Comments
 (0)