📁 dirmap
is a tool for generating a directory map.
It extracts a part of the document from markdown or source code of each directory and uses it as overview of the directory.
$ pwd
/Users/k1low/src/github.com/k1LoW/dirmap
$ dirmap generate
.
├── .github/
│ └── workflows/
├── cmd/ ... Commands.
├── config/ ... Configuration file.
├── matcher/ ... Implementation to find the string that will be the overview from the code or Markdown.
├── output/ ... Output format of the directory map.
├── scanner/ ... Implementation of scanning the target directory and its overview from the file system based on the configuration.
├── scripts/ ... scripts for Dockerfile.
└── version/ ... Version.
$ dirmap generate -t table
| Directory | Overview |
| --- | --- |
| .github/ | |
| .github/workflows/ | |
| cmd/ | Commands. ( [ref](cmd/doc.go) ) |
| config/ | Configuration file ( [ref](config/config.go) ) |
| matcher/ | Implementation to find the string that will be the overview from the code or Markdown. ( [ref](matcher/matcher.go) ) |
| output/ | Output format of the directory map ( [ref](output/output.go) ) |
| scanner/ | Implementation of scanning the target directory and its overview from the file system based on the configuration. ( [ref](scanner/scanner.go) ) |
| scripts/ | Scripts for Dockerfile ( [ref](scripts/.dirmap.md) ) |
| version/ | Version ( [ref](version/version.go) ) |
dirmap
collects overviews for each directory and formats them for display.
$ dirmap generate
.
├── .github/
│ └── workflows/
├── cmd/ ... Commands.
├── config/ ... Configuration file.
├── matcher/ ... Implementation to find the string that will be the overview from the code or Markdown.
├── output/ ... Output format of the directory map.
├── scanner/ ... Implementation of scanning the target directory and its overview from the file system based on the configuration.
├── scripts/ ... scripts for Dockerfile.
└── version/ ... Versi
If you want to change the collection rules, you can create a configuration file ( .dirmap.yml
) to change it.
$ dirmap init
Create .dirmap.yml
$ cat .dirmap.yml
targets:
- file: .dirmap.md
matcher: markdown
- file: README.md
matcher: markdown
- file: doc.go
matcher: godoc
- file: "*.go"
matcher: godoc
The target files to search for overview document in the directory.
The search for the overview document will be performed on the files specified by file:
in order.
If the string is matched by matcher:
, the search in the directory is immediately terminated and the overview document is determined.
targets:
- file: .dirmap.md
matcher: markdown
- file: README.md
matcher: markdown
- file: doc.go
matcher: godoc
- file: '*.go'
matcher: godoc
The directories to be excluded.
ignores:
- dist
- dist/**/*
Get a normal paragraph that is not a heading line without blank lines.
targets:
- file: .dirmap.md
matcher: markdown
Get the first heading line.
targets:
- file: .dirmap.md
matcher: markdownHeading
Get the text that is retrieved as an overview of the package in the godoc page.
targets:
- file: '*.go'
matcher: godoc
If the value of matcher:
does not match any matcher, it is considered a regular expression.
Then, get the first line matched by the regular expression.
Also, if a capture group is used, only the string that matches the first capture group will be retrieved.
targets:
- file: '*.rb'
matcher: '^#+\s+(.+)$'
deb:
Use dpkg-i-from-url
$ export DIRMAP_VERSION=X.X.X
$ curl -L https://git.io/dpkg-i-from-url | bash -s -- https://github.com/k1LoW/dirmap/releases/download/v$DIRMAP_VERSION/dirmap_$DIRMAP_VERSION-1_amd64.deb
RPM:
$ export DIRMAP_VERSION=X.X.X
$ yum install https://github.com/k1LoW/dirmap/releases/download/v$DIRMAP_VERSION/dirmap_$DIRMAP_VERSION-1_amd64.rpm
apk:
Use apk-add-from-url
$ export DIRMAP_VERSION=X.X.X
$ curl -L https://git.io/apk-add-from-url | sh -s -- https://github.com/k1LoW/dirmap/releases/download/v$DIRMAP_VERSION/dirmap_$DIRMAP_VERSION-1_amd64.apk
homebrew tap:
$ brew install k1LoW/tap/dirmap
go install:
$ go install github.com/k1LoW/[email protected]
manually:
Download binary from releases page
docker:
$ docker pull ghcr.io/k1low/dirmap:latest