Documentation ¶
Overview ¶
Copyright <2022> Nik Ogura <nik.ogura@gmail.com>
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.
Copyright <2022> Nik Ogura <nik.ogura@gmail.com>
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.
Copyright <2022> Nik Ogura <nik.ogura@gmail.com>
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.
Copyright <2022> Nik Ogura <nik.ogura@gmail.com>
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.
Copyright <2022> Nik Ogura <nik.ogura@gmail.com>
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.
Index ¶
- func CobraCliToolParamsFromPrompts(params *CobraCliToolParams, r io.Reader) (err error)
- func GetCobraCliToolParamsPromptMessaging() map[ParamPrompt]Prompt
- func GetProjectFs(projType string) (embed.FS, string, error)
- func IsValidProjectType(v string) bool
- func PromptForInput(p Prompt) (data string, err error)
- func ValidProjectTypes() []string
- type CobraCliToolParams
- type FilePath
- type ParamPrompt
- type Prompt
- type PromptValidation
- type PromptValues
- type TmplWriter
- func (w TmplWriter) BuildProject(destDir string) error
- func (w TmplWriter) CreateAllFilePathsAtRoot(root string) error
- func (w TmplWriter) CreatePath(root, file string) error
- func (w TmplWriter) GetFilePaths(root string) ([]FilePath, error)
- func (w TmplWriter) ResolveAllPathTemplates() error
- func (w TmplWriter) ResolveFileTemplateData(fp FilePath) (*bytes.Buffer, error)
- func (w TmplWriter) ResolveTemplateVars(str string) (*bytes.Buffer, error)
- func (w TmplWriter) WriteAllDestFileTemplateData(destDir string) error
- func (w TmplWriter) WriteFileTemplateData(fp FilePath, destDir string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CobraCliToolParamsFromPrompts ¶
func CobraCliToolParamsFromPrompts(params *CobraCliToolParams, r io.Reader) (err error)
func GetCobraCliToolParamsPromptMessaging ¶
func GetCobraCliToolParamsPromptMessaging() map[ParamPrompt]Prompt
func GetProjectFs ¶
GetProjectFs Gets the embedded file system for the project of this type.
func IsValidProjectType ¶
IsValidProjectType Returns true or false depending on whether the project is a supported type.
func PromptForInput ¶
func ValidProjectTypes ¶
func ValidProjectTypes() []string
ValidProjectTypes Lists the valid project types.
Types ¶
type CobraCliToolParams ¶
type CobraCliToolParams struct { ProjectName string ProjectPackage string ProjectShortDesc string ProjectLongDesc string MaintainerName string MaintainerEmail string GolangVersion string DbtRepo string ProjectVersion string }
func (CobraCliToolParams) AsMap ¶
func (cp CobraCliToolParams) AsMap() (output map[string]interface{}, err error)
func (*CobraCliToolParams) Values ¶
func (cp *CobraCliToolParams) Values() map[ParamPrompt]*string
type ParamPrompt ¶
type ParamPrompt string
const ( GoVersion ParamPrompt = "GolangVersion" DockerRegistry ParamPrompt = "DockerRegistry" DockerProject ParamPrompt = "DockerProject" ProjName ParamPrompt = "ProjectName" ProjPkgName ParamPrompt = "ProjectPackage" ProjEnvPrefix ParamPrompt = "EnvPrefix" ProjShortDesc ParamPrompt = "ProjectShortDesc" ProjLongDesc ParamPrompt = "ProjectLongDesc" ProjMaintainerName ParamPrompt = "MaintainerName" ProjMaintainerEmail ParamPrompt = "MaintainerEmail" ServerDefPort ParamPrompt = "DefaultServerPort" ServerShortDesc ParamPrompt = "ServerShortDesc" ServerLongDesc ParamPrompt = "ServerLongDesc" OwnerName ParamPrompt = "OwnerName" OwnerEmail ParamPrompt = "OwnerEmail" DbtRepo ParamPrompt = "DbtRepo" ProjectVersion ParamPrompt = "ProjectVersion" )
func (ParamPrompt) String ¶
func (p ParamPrompt) String() string
type PromptValidation ¶
type PromptValues ¶
type PromptValues interface { Values() map[ParamPrompt]*string AsMap() (data map[string]interface{}, err error) }
func PromptsForProject ¶
func PromptsForProject(proj string) (data PromptValues, err error)
type TmplWriter ¶
type TmplWriter struct { OutFs afero.Fs TemplFs embed.FS FilePaths []FilePath ProjDir string TmplVals map[string]interface{} }
func NewTmplWriter ¶
func (TmplWriter) BuildProject ¶
func (w TmplWriter) BuildProject(destDir string) error
func (TmplWriter) CreateAllFilePathsAtRoot ¶
func (w TmplWriter) CreateAllFilePathsAtRoot(root string) error
func (TmplWriter) CreatePath ¶
func (w TmplWriter) CreatePath(root, file string) error
func (TmplWriter) GetFilePaths ¶
func (w TmplWriter) GetFilePaths(root string) ([]FilePath, error)
func (TmplWriter) ResolveAllPathTemplates ¶
func (w TmplWriter) ResolveAllPathTemplates() error
func (TmplWriter) ResolveFileTemplateData ¶
func (w TmplWriter) ResolveFileTemplateData(fp FilePath) (*bytes.Buffer, error)
func (TmplWriter) ResolveTemplateVars ¶
func (w TmplWriter) ResolveTemplateVars(str string) (*bytes.Buffer, error)
func (TmplWriter) WriteAllDestFileTemplateData ¶
func (w TmplWriter) WriteAllDestFileTemplateData(destDir string) error
func (TmplWriter) WriteFileTemplateData ¶
func (w TmplWriter) WriteFileTemplateData(fp FilePath, destDir string) error