makego

command module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2024 License: MIT Imports: 16 Imported by: 0

README

Makego

Makego is a customizable code generator that sets up the basics of an API framework in Go to let you quickly launch an api.

Running the app

Usage:
  makego [flags] [package_name]

Flags:
      --config string      config file (default is $HOME/makego.yaml)
      --copyright string   copyright holder (and contact if desired)
      --database string    database type to use (mysql, mariadb, postgres, etc) (default "postgres")
  -d, --docker             whether to use docker
      --envprefix string   how to expect env variables to be prefixed
      --folder string      application folder, can be left blank for no folder
  -a, --header             whether to show copyright headers on most files
  -h, --help               help for makego
      --license string     license, can be left blank for proprietary code
      --name string        application name
      --orm string         ORM to use for models (defaults to gorm) (default "gorm")
      --router string      router to use (echo, gin, http, mux) (default "gin")
  -s, --sentry             whether to use sentry

[package_name] is required if the go.mod file is not already set up.

WARNING: Already existing files with the same name will be overwritten. Care should be taken to backup files before running this.

Optionally, a config file can be used with the above flags. If the $HOME/makego.yaml exists, it will be used, so you can use that to cut down on the amount of flags you need to use, especially if you set the same flags consistently.

The config file also includes a templates section, where you can specify additional files to create (see below for an example). Templates are given in the form of filepath: contents. Where filepath is both relative and regulated to project folder.

Example config.yml file
name: Example App                  # Application Name (setting this in $HOME/makego.yaml is not recommended)
folder: application                # Application folder, can be left out or blank for no folder
license: mit                       # License, can be left blank for proprietary code
copyright: user <user@example.com> # The copyright holder (and contact if desired)
router: gin                        # The router to use (echo, gin, mux, etc)
orm: gorm                          # The orm to use (currently only gorm is supported)
database: postgres                 # The database type to use (mysql, mariadb, postgres, etc)
sentry: true                       # Whether or not to use Sentry
header: true                       # Whether or not to add copyright header to code files
docker: true                       # Whether or not to use Docker
envprefix: app                     # How to expect environment variables to be prefixed, can be left out or blank for no prefix
templates:
  application/example.txt: |       # File name (including path from base folder)
    this
    is
    a
    file
  CONTRIBUTING.md: |               # File name (including path from base folder)
    # Rules

	Here are some rules for contributing to this project

If you wish to include the license header in your template, put {{ template "header.template" . }} at the beginning.

Documentation

Overview

Copyright © 2024 Jason Jackson

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.

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.

Jump to

Keyboard shortcuts

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