Skip to content
/ manaita Public

Simple Markdown-Driven Scaffolding tool written by Go

License

Notifications You must be signed in to change notification settings

igtm/manaita

Repository files navigation

Manaita

Simple Markdown-Driven Scaffolding tool written by Go

Write your scaffolding code on SCAFFOLD.md and generate files using the scaffold.

Scaffold file is Markdown format. so you can see it on Github and easily understand what will be generated.

manaita

Installation

Brew

brew install igtm/tap/manaita

Go Install

go install github.com/igtm/manaita@latest

Install with curl

curl -sfL https://raw.githubusercontent.com/igtm/manaita/master/install.sh | sudo sh -s -- -b /usr/local/bin

Getting Started

  1. put SCAFFOLD.md on your directory
---
Params:
- name
---

# foo.go

```golang
package foo

var foo = "foo"
```


# {{.Params.name}}/bar.py

```python
print("bar.py")
```
  1. Run manaita -p name=dog
  2. foo.go and dog/bar.py files are generated

Usage

manaita -c ./path/to/SCAFFOLD.md -p key=value

Available options:

  -c                  specify markdown scaffold file path. default name is 'SCAFFOLD.md'
                        supported types:
                          - local path         e.g. 'path/to/SCAFFOLD.md'
                          - go get style path: e.g. 'github.com/owner/repo/path/to/SCAFFOLD.md'
                          - http url:          e.g. 'https://example.com/SCAFFOLD.md'
  -p                  specify parameters for scaffold template. these must be defined on markdown  e.g. '-p foo=bar,fizz=buzz'

Available template params:

  {{.Env}}            can access environment variables
  {{.Params}}         can access given parameters by '-p' option, which must be defined on 'Params' field of markdown header.

Available template functions:

AnyKind of_string

Function Result
ToUpper ANY KIND OF_STRING
ToLower anykind of_string
ToSnake any_kind_of_string
ToScreamingSnake ANY_KIND_OF_STRING
ToKebab any-kind-of-string
ToScreamingKebab ANY-KIND-OF-STRING
ToCamel AnyKindOfString
ToLowerCamel anyKindOfString

This library uses Go Template.

so you can use any Go Template syntax like '{{if foo}} .. {{end}}' and like that.

References

Trouble Shooting

  • cannot get private repo.

it is cloned through ssh. so you need setup ~/.ssh/config. (currently only @branch is supported on private repo)

  • when you get ssh: handshake failed: knownhosts: key mismatch.
ssh-keyscan -H github.com >> ~/.ssh/known_hosts