{"id":20659412,"url":"https://github.com/faaxm/semo","last_synced_at":"2025-10-29T01:46:27.496Z","repository":{"id":57514873,"uuid":"239372065","full_name":"faaxm/semo","owner":"faaxm","description":"Scaffolding/Templating tool for easy project setup","archived":false,"fork":false,"pushed_at":"2020-02-27T17:06:19.000Z","size":20,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-17T11:46:04.790Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/faaxm.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-02-09T20:48:43.000Z","updated_at":"2021-12-05T05:45:47.000Z","dependencies_parsed_at":"2022-08-30T01:40:26.728Z","dependency_job_id":null,"html_url":"https://github.com/faaxm/semo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/faaxm%2Fsemo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/faaxm%2Fsemo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/faaxm%2Fsemo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/faaxm%2Fsemo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/faaxm","download_url":"https://codeload.github.com/faaxm/semo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242772295,"owners_count":20182742,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-16T18:34:18.773Z","updated_at":"2025-10-29T01:46:22.478Z","avatar_url":"https://github.com/faaxm.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Semo\n\nSemo is a generic scaffolding/templating tool.\nBuild a template for your favourite project structure and use Semo to instantiate new copies of it with a single command.\n\nYou can also place templates at the root of a project to easily extend it and make it easy to have a consistent file structure.\nFor example, run\n```\n$ semo new_controller MyControllerName\n```\nand a new controller class will be created in the right directory of your project.\n\n\n# How to install\n\nThe easiest way is to first install `go` and then run\n```\n$ go get github.com/faaxm/semo/cmd/semo\n$ go install github.com/faaxm/semo/cmd/semo\n```\nSemo will then be downloaded and installed into your go-workspace, which is usually in your user directory at `~/go`.\n\nPlace your template files either in your user directory at `~/.semo/templates` or in your project's root folder\nin `semo_templates`.\n\n\n# First Steps\n\nSemo finds templates by converting their name to a path. For example the template `cpp.class` can be found in\n`semo_templates` in the subdirectory `cpp/class`.\n\nTo create a new c++ class, consisting of a header and a cpp-file, go to the root directory of the repository (or any subdirectory)\nand type\n```\n$ semo cpp.class MyClass\n```\nSemo will then create a `MyClass.cpp` and `MyClass.h` file.\n\n\n# Creating your own templates\n\nThe simplest template in Semo is just a directory with the templates name. Inside that root directory, there has to be a\n`_template_files` directory containing the files and directories that will be copied when the template is instantiated.\n\nA very simple template for a c header file could look like this:\n```\nheader\n└── _template_files\n    └── {{ .arg_0 }}.h\n```\n\nNotice the name of the template header file contains `{{ .arg_0 }}`. This part will be replaced with the first\nargument given to Semo when invoked on the command line. To create a header with the name \"TestHeader\", you\nwould call Semo like this:\n```\n$ semo header TestHeader\n```\n\nThe same placeholders (`{{ .arg_0 }}`, `{{ .arg_1 }}`, ..., `{{ .arg_N }}`) can be used inside the template header file.\n\nFor more information on how these placeholders work, have a look at the `text/template` package from go:\nhttps://golang.org/pkg/text/template/\n\n\n# More advanced templates\n\nIf you don't want to use the standard `.arg_N` placeholders, you can define your own field names together with\ndefault values. To do this, create a `config.yml` file inside the root directory of your template.\n\nThis file contains a `fields` entry with a list of the required fields. Each field has to have a `name`, but can\nalso have a `description` and a `default` value. Have a look at the \"cpp.class\" template for an example.\n\nValues for each field can still be given on the command line in the order in which they are defined in the\n`config.yml` file. However, you can now also call `semo` without providing any arguments other than the\ntemplate name, like\n```\n$ semo cpp.class\n```\nIn that case, Semo will query the user interactively for the data, with the option of using the default\nvalue.\n\n\n# Functions\n\nSemo provides several functions to alter the input field values:\n\n* `{{ toUpper .arg_0 }}`: Convert all characters of `.arg_0` to upper case.\n* `{{ toLower .arg_0 }}`: Convert all characters of `.arg_0` to lower case.\n* `{{ noWhitespace .arg_0 }}`: Remove all whitespace from `.arg_0` and replace it with underscores.\n* `{{ runID N }}`: Returns a unique ID of maximum length `N`. This ID is generated once when Semo is launched\n  and will stay the same for all files in the template.\n\nAdditional functions are provided by the `test/template` package of go. You can also concatenate function calls\nlike this: `{{ toUpper (runID 5) }}`.\n\n# License\n\nThis project is licensed under the terms of the GPL version 3.0 license. See LICENSE.txt for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffaaxm%2Fsemo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffaaxm%2Fsemo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffaaxm%2Fsemo/lists"}