All Projects → hofstadter-io → Hof

hofstadter-io / Hof

Licence: bsd-3-clause
The High Code Framework (low-code for devs)

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to Hof

Kit Phpencoder
Highly customizable alternative to var_export for PHP code generation
Stars: ✭ 65 (-52.9%)
Mutual labels:  code-generator
Goreuse
Generic Code for Go
Stars: ✭ 93 (-32.61%)
Mutual labels:  code-generator
Openapi Cli Generator
Generate a CLI from an OpenAPI 3 specification
Stars: ✭ 121 (-12.32%)
Mutual labels:  code-generator
Aarkay Archived
AarKay is a language independent code generation framework. This project has been deprecated and is no longer maintained.
Stars: ✭ 69 (-50%)
Mutual labels:  code-generator
Php Generator
🐘 Generates neat PHP code for you. Supports new PHP 8.0 features.
Stars: ✭ 1,264 (+815.94%)
Mutual labels:  code-generator
Geco
Simple code generator based on a console project, running on .Net core and using C# interpolated strings
Stars: ✭ 97 (-29.71%)
Mutual labels:  code-generator
Professional Codes Reader
Browse the web like a professional programmer!
Stars: ✭ 63 (-54.35%)
Mutual labels:  code-generator
Toolkit
Collection of useful patterns
Stars: ✭ 137 (-0.72%)
Mutual labels:  code-generator
R.objc
Get autocompleted resources like images, localized strings and storyboards in ObjC projects
Stars: ✭ 92 (-33.33%)
Mutual labels:  code-generator
Super enum
Create super-powered dart enums similar to sealed classes in Kotlin
Stars: ✭ 114 (-17.39%)
Mutual labels:  code-generator
Terrastack
This project is archived, but the idea of Terrastack lives on in the Terraform CDK. - https://github.com/hashicorp/terraform-cdk
Stars: ✭ 71 (-48.55%)
Mutual labels:  polyglot
Deep Copy
Deep copy generator
Stars: ✭ 82 (-40.58%)
Mutual labels:  code-generator
Python Chess
A chess library for Python, with move generation and validation, PGN parsing and writing, Polyglot opening book reading, Gaviota tablebase probing, Syzygy tablebase probing, and UCI/XBoard engine communication
Stars: ✭ 1,341 (+871.74%)
Mutual labels:  polyglot
Mid
mid is a generic domain-specific language for generating code and documentation
Stars: ✭ 68 (-50.72%)
Mutual labels:  code-generator
Iconic
🎨 Auto-generated icon font library for iOS, watchOS and tvOS
Stars: ✭ 1,567 (+1035.51%)
Mutual labels:  code-generator
Automation
code generator
Stars: ✭ 65 (-52.9%)
Mutual labels:  code-generator
Tweetable Polyglot Png
Pack up to 3MB of data into a tweetable PNG polyglot file.
Stars: ✭ 299 (+116.67%)
Mutual labels:  polyglot
Projecteuler
Polyglot solutions for www.projecteuler.net mathematical challenges
Stars: ✭ 137 (-0.72%)
Mutual labels:  polyglot
Reference Architectures
[WIP] Get up and running quickly with one of our reference architecture using our fully automated cold-start process.
Stars: ✭ 127 (-7.97%)
Mutual labels:  code-generator
Twirp
PHP port of Twitch's Twirp RPC framework
Stars: ✭ 108 (-21.74%)
Mutual labels:  code-generator

hof - the high code framework

The hof tool tries to remove redundent development activities by using high level designs, code generation, and diff3 while letting you write custom code directly in the output. ( low-code for developers )

  • Users write Single Source of Truth (SSoT) design for data models and the application generators
  • hof reads the SSoT, processes it through the code generators, and outputs directories and files
  • Users can write custom code in the output, change their designs, and regenerate code in any order
  • hof can be customized and extended by only editing text files and not hof source code.
  • Use your own tools, technologies, and practices, hof does not make any choices for you
  • hof is powered by Cue (https://cuelang.org & https://cuetorials.com)

Install

You will have to download hof the first time. After that hof will prompt you to update and install new releases as they become available.

# Install (Linux, Mac, Windows)
curl -LO https://github.com/hofstadter-io/hof/releases/download/v0.5.15/hof_0.5.15_$(uname)_$(uname -m)
mv hof_0.5.15_$(uname)_$(uname -m) /usr/local/bin/hof

# Shell Completions (bash, zsh, fish, power-shell)
echo ". <(hof completion bash)" >> $HOME/.profile
source $HOME/.profile

# Show the help text
hof --help

You can always find the latest version from the releases page or use hof to install a specific version of itself with hof update --version vX.Y.Z.

Documentation

Please see https://docs.hofstadter.io to learn more.

Join us on Slack! https://hofstadter-io.slack.com (invite link)

Example

There are currently hof modules for:

  • hofmod-cli - CLI infrastructure based on the Golang Cobra library.
  • hofmod-server - API server based on the Golang Echo library.

You can see them used in:

  • hof uses hofmod-cli
  • saas uses hofmod-server

The following is a single file example:

package gen

import (
	// import hof's schemas for our generator
	"github.com/hofstadter-io/hof/schema"
)

// A schema for our generator's input
#Input: {
	name: string
	todos: [...{
		name: string
		effort: int
		complete: bool
	}]
}
// create a generator
#Gen: schema.#HofGenerator & {
	// We often have some input values for the user to provide.
	// Use a Cue definition to enforce a schema
	Input: #Input

	// Required filed for generator definitions, details can be found in the hof docs
	PackageName: "dummy"

	// Required field for a generator to work, the list of files to generate
	Out: [...schema.#HofGeneratorFile] & [
		todo,
		done,
		debug,
	]

	// In is supplied as the root data object to every template
	// pass user inputs to the tempaltes here, possibly modified, enhanced, or transformed
	In: {
		INPUT: Input
		Completed: _C
		Incomplete: _I
	}

	// calculate some internal data from the input
	_C: [ for t in Input.todos if t.complete == true { t } ]
	_I: [ for t in Input.todos if t.complete == false { t } ]

	// the template files
	todo: {
		Template: """
		Hello {{ .INPUT.name }}.

		The items still on your todo list:

		{{ range $T := .Incomplete -}}
		{{ printf "%-4s%v" $T.name $T.effort }}
		{{ end }}
		"""
		// The output filename, using string interpolation
		Filepath: "\(Input.name)-todo.txt"
	}
	done: {
		Template: """
		Here's what you have finished {{ .INPUT.name }}. Good job!

		{{ range $T := .Completed -}}
		{{ $T.name }}
		{{ end }}
		"""
		Filepath: "\(Input.name)-done.txt"
	}

	// useful helper
	debug: {
		Template: """
		{{ yaml . }}
		"""
		Filepath: "debug.yaml"
	}
}

// Add the @gen(<name>,<name>,...) to denote usage of a generator
Gen: _ @gen(todos)
// Construct the generator
Gen: #Gen & {
	Input: {
		// from first.cue
		name: gen.data.name
		todos: gen.data.tasks
	}
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].