package
1.23.0
Repository: https://github.com/onsdigital/dp-cli.git
Documentation: pkg.go.dev

# README

Project Generation

What

This tool can be used to create projects of the following categories:

  • generic-project
    • base-application
      • api
      • controller
      • event-driven

How to use

It is always beneficial to ensure you are using the most up to date version of the dp-cli tool. To update pull the latest changes and rebuild the tool like so:

git pull; make install; 
dp generate-project

This tool can be used in conjunction with the repository creation tool, for further details read COMPLETE_PROJECT_SETUP.md

Optional flags

Although these flags are optional, for most, if they are not provided then the user will be prompted for details.

  • --name : The name of the application, if Digital specific application it should be prepended with 'dp-'
  • --go-version : The version of Go the application should use (Not used on generic-projects)
  • --project-location : Location to generate project in
  • --create-repository : Should a repository be created for the project, default no. Value can be y/Y/yes/YES/ or n/N/no/NO")
  • --type : Type of application to generate, values can be: 'generic-project', 'base-application', 'api', 'controller', 'event-driven'")

Example output

The project generation command has been used to create example outputs of the various types of project. These can be found in the dp-hello-world repository. This provides a place where issues and discussions around the content of the base projects can be discussed and agreed upon. Once agreed upon there, the changes need to be applied to the templates in this repository and the example output can be regenerated with the new version of this tool, ready for further improvements.

# Functions

FinaliseModules will run go build ./..
FormatGoFiles will run go fmt ./..
GenerateProject is the entry point into generating a project.
InitGoModules will initialise the go modules for a project at a given directory unless go.mod already exists.
IsEmptyDir will check if a given directory is empty or not.
OfferPurgeProjectDestination will offer the user an option to purge the contents at a given location.
No description provided by the author
PopulateTemplateModel will populate the templating model with variables that can be used in templates.
PromptForConfirmation will prompt for yes/no style answers on command-line.
PromptForInput will write a line to output then wait for input which is returned from the function.
ValidateAppDescription will ensure that the app description has been provided and is acceptable, if not it will keep prompting until it is.
ValidateAppName will ensure that the app name has been provided and is acceptable, if not it will keep prompting until it is.
No description provided by the author
ValidateBranchingStrategy will ensure that the strategy provided by the user is one that can be boilerplate.
No description provided by the author
No description provided by the author
No description provided by the author
ValidateProjectLocation will ensure that the projects location has been provided and is acceptable.
ValidateProjectType will ensure that the project type provided by the users is one that can be boilerplate.
No description provided by the author

# Constants

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Structs

No description provided by the author

# Type aliases

No description provided by the author
No description provided by the author