dirmap

command module
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 30, 2024 License: MIT Imports: 1 Imported by: 0

README ΒΆ

dirmap

πŸ“ 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.

Quick Start

$ 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) ) |

Usage

dirmap generate

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
dirmap init

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

Configuration

targets:

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
ignores:

The directories to be excluded.

ignores:
  - dist
  - dist/**/*

Available matcher

markdown

Get a normal paragraph that is not a heading line without blank lines.

targets:
- file: .dirmap.md
  matcher: markdown
markdownHeading

Get the first heading line.

targets:
- file: .dirmap.md
  matcher: markdownHeading
godoc

Get the text that is retrieved as an overview of the package in the godoc page.

targets:
- file: '*.go'
  matcher: godoc
regexp

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+(.+)$'

Install

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

Documentation ΒΆ

Overview ΒΆ

Copyright Β© 2021 Ken'ichiro Oyama <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Directories ΒΆ

Path Synopsis
Commands.
Commands.
Configuration file
Configuration file
Implementation to find the string that will be the overview from the code or Markdown.
Implementation to find the string that will be the overview from the code or Markdown.
Output format of the directory map
Output format of the directory map
Implementation of scanning the target directory and its overview from the file system based on the configuration.
Implementation of scanning the target directory and its overview from the file system based on the configuration.
Version
Version

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL