mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-03-03 04:03:59 -04:00
Tools: gittools: add scripts that list subsystems
Those scripts print a list of subsystems (first level folders and libraries). They are useful for other future tools.
This commit is contained in:
parent
bd7c313bee
commit
c2a940ddea
45
Tools/gittools/path-libraries.sh
Executable file
45
Tools/gittools/path-libraries.sh
Executable file
@ -0,0 +1,45 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
usage() {
|
||||||
|
cat >&$1 <<EOF
|
||||||
|
Usage: $0 [OPTIONS]
|
||||||
|
|
||||||
|
Read a list of files relative to ardupilot's root directory and output the
|
||||||
|
libraries they belong to.
|
||||||
|
|
||||||
|
Options:
|
||||||
|
--show-paths, -p Print also file paths after the library name.
|
||||||
|
--help, -h Show this help message.
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
show_paths=false
|
||||||
|
|
||||||
|
while [[ -n $1 ]]; do
|
||||||
|
case "$1" in
|
||||||
|
--show-paths|-p)
|
||||||
|
show_paths=true
|
||||||
|
;;
|
||||||
|
--help|-h)
|
||||||
|
usage 1
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
usage 2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
|
||||||
|
if $show_paths; then
|
||||||
|
sedcmd="s,libraries/\([^/]\+\).*,\1\t\0,"
|
||||||
|
else
|
||||||
|
sedcmd="s,libraries/\([^/]\+\).*,\1,"
|
||||||
|
fi
|
||||||
|
|
||||||
|
grep "^libraries/[^\/]\+" | \
|
||||||
|
sed $sedcmd | \
|
||||||
|
sort | \
|
||||||
|
uniq
|
57
Tools/gittools/path-nonlibraries.sh
Executable file
57
Tools/gittools/path-nonlibraries.sh
Executable file
@ -0,0 +1,57 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
usage() {
|
||||||
|
cat >&$1 <<EOF
|
||||||
|
Usage: $0 [OPTIONS]
|
||||||
|
|
||||||
|
Read a list of files relative to ardupilot's root directory and output the
|
||||||
|
non-libraries subsystems they belong to.
|
||||||
|
|
||||||
|
Options:
|
||||||
|
--show-paths, -p Print also file paths after the library name.
|
||||||
|
--help, -h Show this help message.
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
show_paths=false
|
||||||
|
|
||||||
|
while [[ -n $1 ]]; do
|
||||||
|
case "$1" in
|
||||||
|
--show-paths|-p)
|
||||||
|
show_paths=true
|
||||||
|
;;
|
||||||
|
--help|-h)
|
||||||
|
usage 1
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
usage 2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
|
||||||
|
SCRIPT_DIR=$(dirname $(realpath ${BASH_SOURCE[0]}))
|
||||||
|
ROOT=$(dirname $(git -C $SCRIPT_DIR rev-parse --git-dir))
|
||||||
|
|
||||||
|
if $show_paths; then
|
||||||
|
sedcmd="s,\([^/]\+\).*,\1\t\0,"
|
||||||
|
else
|
||||||
|
sedcmd="s,\([^/]\+\).*,\1,"
|
||||||
|
fi
|
||||||
|
|
||||||
|
grep -v "^libraries" | \
|
||||||
|
sed $sedcmd | \
|
||||||
|
sort | \
|
||||||
|
uniq | \
|
||||||
|
if $show_paths; then
|
||||||
|
while read d f; do
|
||||||
|
[[ -d "$ROOT/$d" ]] && printf "%s\t%s\n" "$d" "$f"
|
||||||
|
done
|
||||||
|
else
|
||||||
|
while read d; do
|
||||||
|
[[ -d "$ROOT/$d" ]] && echo "$d"
|
||||||
|
done
|
||||||
|
fi
|
Loading…
Reference in New Issue
Block a user