Skip to content

Commit

Permalink
Modules TOC
Browse files Browse the repository at this point in the history
  • Loading branch information
bentonam committed Apr 5, 2024
1 parent 4547ee0 commit bb89f8b
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 0 deletions.
38 changes: 38 additions & 0 deletions modules/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Modules

- [brokers](modules/brokers/)
- [rabbitmq](modules/brokers/rabbitmq/)
- [cloud](modules/cloud/)
- [grafana](modules/cloud/grafana/)

Check failure on line 6 in modules/README.md

View workflow job for this annotation

GitHub Actions / textlint

[textlint] modules/README.md#L6 <eslint.rules.terminology>

Incorrect usage of the term: “grafana”, use “Grafana” instead (terminology)
Raw output
/home/runner/work/flow-modules/flow-modules/modules/README.md:6:10: error: Incorrect usage of the term: “grafana”, use “Grafana” instead (terminology) (eslint.rules.terminology)
- [cloud](modules/cloud/grafana/cloud/)
- [collectors](modules/collectors/)
- [agent](modules/collectors/agent/)
- [push-gateway](modules/collectors/push-gateway/)
- [databases](modules/databases/)
- [kv](modules/databases/kv/)
- [etcd](modules/databases/kv/etcd/)
- [memcached](modules/databases/kv/memcached/)
- [redis](modules/databases/kv/redis/)
- [sql](modules/databases/sql/)
- [mysql](modules/databases/sql/mysql/)
- [postgres](modules/databases/sql/postgres/)
- [timeseries](modules/databases/timeseries/)
- [loki](modules/databases/timeseries/loki/)

Check failure on line 20 in modules/README.md

View workflow job for this annotation

GitHub Actions / textlint

[textlint] modules/README.md#L20 <eslint.rules.terminology>

Incorrect usage of the term: “loki”, use “Loki” instead (terminology)
Raw output
/home/runner/work/flow-modules/flow-modules/modules/README.md:20:14: error: Incorrect usage of the term: “loki”, use “Loki” instead (terminology) (eslint.rules.terminology)
- [mimir](modules/databases/timeseries/mimir/)

Check failure on line 21 in modules/README.md

View workflow job for this annotation

GitHub Actions / textlint

[textlint] modules/README.md#L21 <eslint.rules.terminology>

Incorrect usage of the term: “mimir”, use “Mimir” instead (terminology)
Raw output
/home/runner/work/flow-modules/flow-modules/modules/README.md:21:14: error: Incorrect usage of the term: “mimir”, use “Mimir” instead (terminology) (eslint.rules.terminology)
- [pyroscope](modules/databases/timeseries/pyroscope/)
- [tempo](modules/databases/timeseries/tempo/)

Check failure on line 23 in modules/README.md

View workflow job for this annotation

GitHub Actions / textlint

[textlint] modules/README.md#L23 <eslint.rules.terminology>

Incorrect usage of the term: “tempo”, use “Tempo” instead (terminology)
Raw output
/home/runner/work/flow-modules/flow-modules/modules/README.md:23:14: error: Incorrect usage of the term: “tempo”, use “Tempo” instead (terminology) (eslint.rules.terminology)
- [kubernetes](modules/kubernetes/)
- [cert-manager](modules/kubernetes/cert-manager/)
- [core](modules/kubernetes/core/)
- [konnectivity-agent](modules/kubernetes/konnectivity-agent/)
- [kube-state-metrics](modules/kubernetes/kube-state-metrics/)
- [opencost](modules/kubernetes/opencost/)
- [networking](modules/networking/)
- [consul](modules/networking/consul/)
- [haproxy](modules/networking/haproxy/)
- [source-control](modules/source-control/)
- [gitlab](modules/source-control/gitlab/)
- [system](modules/system/)
- [node-exporter](modules/system/node-exporter/)
- [ui](modules/ui/)
- [grafana](modules/ui/grafana/)

Check failure on line 38 in modules/README.md

View workflow job for this annotation

GitHub Actions / textlint

[textlint] modules/README.md#L38 <eslint.rules.terminology>

Incorrect usage of the term: “grafana”, use “Grafana” instead (terminology)
Raw output
/home/runner/work/flow-modules/flow-modules/modules/README.md:38:10: error: Incorrect usage of the term: “grafana”, use “Grafana” instead (terminology) (eslint.rules.terminology)
34 changes: 34 additions & 0 deletions tools/generate-toc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash

echo "# Modules"
echo ""

# Function to check if directory (or its subdirectories) contains .md files
contains_md_files() {
local dir="$1"
if find "$dir" -type f -name "*.md" | read; then

Check notice on line 9 in tools/generate-toc.sh

View workflow job for this annotation

GitHub Actions / shellcheck

[shellcheck] tools/generate-toc.sh#L9 <ShellCheck.SC2162>

read without -r will mangle backslashes.
Raw output
./tools/generate-toc.sh:9:43: info: read without -r will mangle backslashes. (ShellCheck.SC2162)
return 0 # True, contains .md files
else
return 1 # False, does not contain .md files
fi
}

# Function to generate nested markdown list
generate_list() {
local parent_path="$1"
local indent="$2"
# List directories first
for dir in $(find "$parent_path" -mindepth 1 -maxdepth 1 -type d | sort); do
if contains_md_files "$dir"; then
local dir_name=$(basename "$dir")

Check warning on line 23 in tools/generate-toc.sh

View workflow job for this annotation

GitHub Actions / shellcheck

[shellcheck] tools/generate-toc.sh#L23 <ShellCheck.SC2155>

Declare and assign separately to avoid masking return values.
Raw output
./tools/generate-toc.sh:23:19: warning: Declare and assign separately to avoid masking return values. (ShellCheck.SC2155)
echo "${indent}- [${dir_name}](${dir}/)"
# Check and list subdirectories if they contain .md files
if [ "$(find "$dir" -mindepth 1 -maxdepth 1 -type d)" ]; then
generate_list "$dir" "$indent "
fi
fi
done
}

# Start from the top-level "modules" directory
generate_list "modules" ""

0 comments on commit bb89f8b

Please sign in to comment.