Skip to content

sftsrv/dejavu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Déjà vu

Developers don't search for documentation. Just bring it to them instead.

dejavu surfaces documentation that may be relevant to your developers alongside the output of your normal CLI commands

dejavu in action

Installation

The project is still in the early stages of development, at the moment it's only possible to install using go install

go install

go install github.com/sftsrv/dejavu@latest

Usage

Note

Welcome! If you're using this then consider yourself now a bug hunter. Let me know if you find any issues so that we can make this better for everyone!

The application can be used by piping any other command on which you'd like to surface documentation, for example cat myfile.txt:

cat myfile.txt | dejavu

Tip

Since dejavu works with the Stdin stream only, in some cases you may need to merge Stin and Stderr into a single stream so that it can be used as expected, doing will depend on the shell you're using

Documentation Structure

Each doc should be a markdown file that contains frontmatter with a patterns property which is a list of regular expressions on which the document should be shown:

Patterns are matched on a single line

---
# list of patterns to match for this doc to be shown
patterns:
  - "^MY_ERROR"
  - "BADBAD"
# list of tags that apply to this doc
tags:
  - error
  - setup
# summary to be shown if dejavu is running in `summary` mode
summary: This is a bad error
---

# MY_ERROR or BADBAD Error Handling Doc

These are common errors that we can see when running some tests,
they are triggered if we see output with a line starting with
`MY_ERROR` or any text containing `BADBAD`

Configuration

dejavu can be configured by using a dejavu.config.json file with the following structure:

{
  "docs": "./faq",
  "summary": true,
  "tags": [
    "warning",
    "error"
  ]
}

The config file can also be set with the --config flag.

Values from the configuration may also be overidden using the matching command line arguments. These can be found by using dejavu --help

Development

Basically, find something to pipe, this can be anything that sends some output, e.g cat myfile.txt and pipe that into go run .:

cat myfile.txt | go run .

References

About

have the docs? got the docs.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages