Skip to content

m-r-maxwell/forge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Forge

This project is inspired by the likes of t3 create-react-app, ng generate, etc but with a focus on go.

Commands

  • Blank: An empty go project
  • CLI: Blank CLI template
  • Completion: Inbuilt completions for your terminal
  • Help: Is the inbuilt cobra help command
  • Models: This creates a models folder/file to store model information
  • Python: A blank python app.py
  • Rest: A rest microservice template using http/net
  • Service: Service templates

Flags

  • -g --git: Initialize a git repo

That's cool and all but why though?

I honestly just wanted to explore cobra more thoroughly, and this can be useful for me in the future as I create random Go projects. I know it's not hard to create new projects in go, but maybe this can evolve over time as become more familiar with cobra. I've found the best way to learn something is to put it in action.

Command Usage

blank:

Generic empty go project.

forge blank [name]
# blank aliases: b, --b, new 
# name is optional, if not provided user is prompted for one

cli:

Cobra focused CLI project

forge cli [name]
# cli aliases: c --c
# name is optional, if not provided user in prompted for one

git:

just another way to init a git repo

forge blank [name] -g
# alias b

help:

The inbuilt help command

forge help

models:

Create a models folder and file

forge models
# alias m

restful API:

Create a rest API with net/http (assuming go 1.22) with middleware, helpers, models, etc.

forge rest [name]
# alias r

python script

Create a python file

forge python [name]
#alias p

service:

Create a new service structure for apis

forge service [name]
# alias s



Future stuff

Ideally I would love to add gRPC as a template option, but that seems a bit trickier to do at this time and will play around with it.



There is also an included Taskfile with the ability to build for different OSes.

  • build-mac
  • bin-mac: adds to /usr/local/bin
  • build-linux
  • bin-linux: adds to /usr/local/bin
  • build-windows
  • bin-windows: adds to C:\Windows\System32\
  • zsh-ac: creates zsh auto complete instructions
  • pwsh-ac: creates pwsh auto complete instructions

Lastly

If you have any feedback or ways to improve this this I am happy to connect and discuss.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages