CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
Ardupilot

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.

GitHub Repository: Ardupilot/ardupilot
Path: blob/master/Tools/gittools/path-libraries.sh
Views: 1798
1
#!/usr/bin/env bash
2
3
usage() {
4
cat >&$1 <<EOF
5
Usage: $0 [OPTIONS]
6
7
Read a list of files relative to ardupilot's root directory and output the
8
libraries they belong to.
9
10
Options:
11
--show-paths, -p Print also file paths after the library name.
12
--help, -h Show this help message.
13
EOF
14
}
15
16
show_paths=false
17
18
while [[ -n $1 ]]; do
19
case "$1" in
20
--show-paths|-p)
21
show_paths=true
22
;;
23
--help|-h)
24
usage 1
25
exit 0
26
;;
27
*)
28
usage 2
29
exit 1
30
;;
31
esac
32
33
shift
34
done
35
36
if $show_paths; then
37
sedcmd="s,libraries/\([^/]\+\).*,\1\t\0,"
38
else
39
sedcmd="s,libraries/\([^/]\+\).*,\1,"
40
fi
41
42
grep "^libraries/[^\/]\+" | \
43
sed $sedcmd | \
44
sort | \
45
uniq
46
47