Skip to content

Commit

Permalink
feat: enable the License customization
Browse files Browse the repository at this point in the history
  • Loading branch information
thazelart committed Dec 17, 2022
1 parent f913bde commit bc071d7
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 26 deletions.
23 changes: 21 additions & 2 deletions .go-archetype.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ inputs:
- id: maintainer
text: Who is the maintainer? (e.g. Thibault HAZELART <thazelart@gmail.com>)
type: text
- id: license
text: What is a software license? (e.g. Apache 2.0, MIT ...)
type: text
before:
operations:
- sh:
Expand All @@ -32,6 +35,7 @@ transformations:
replacement: "{{ wrap 80 .short_description }}"
files:
- "cmd/root.go"
- ".goreleaser"
- name: project long description
type: replace
pattern: An opinionated template for new Golang cli projects.
Expand Down Expand Up @@ -71,6 +75,9 @@ transformations:
replacement: "{{ .repo_user }}"
files:
- "scripts/fury-upload.sh"
- "README.md"
- ".goreleaser.yaml"
- "Makefile"
- name: project name
type: replace
pattern: golang-cli-template
Expand All @@ -94,17 +101,29 @@ transformations:
- "*.go"
- "**/*.go"
- "Dockerfile"
- ".goreleaser.yaml"
- name: license
type: replace
pattern: Apache 2.0
replacement: "{{ .license }}"
files:
- "*.go"
- "**/*.go"
- "Dockerfile"
- ".goreleaser.yaml"
- "README.md"
- name: do not include template code in the final output
type: include
region_marker: __DO_NOT_INCLUDE__
condition: false
files: ["**"]
- name: remove .go-archtype.yaml
- name: remove unwanted files
type: include
region_marker: # When there's no marker, the entire file(s) is included
condition: "yes"
files:
- ".go-archtype.yaml"
- ".go-archetype.yaml"
- "LICENSE"
after:
operations:
- sh:
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<h1 align="center"> golang-cli-template</h1>

<p align="center">
<a href="https://github.com/gojp/goreportcard/blob/master/LICENSE" rel="nofollow"><img src="https://img.shields.io/badge/License-Apache%202.0-blue.svg" alt="License Apache 2.0" style="max-width:100%;"></a>
<a href="https://github.com/gojp/goreportcard/blob/master/LICENSE" rel="nofollow"><img src="https://img.shields.io/badge/License-Apache 2.0-blue.svg" alt="License Apache 2.0" style="max-width:100%;"></a>
<a href="https://pkg.go.dev/github.com/thazelart/golang-cli-template" rel="nofollow"><img src="https://pkg.go.dev/badge/github.com/thazelart/golang-cli-template.svg" alt="Go reference" style="max-width:100%;"></a>
<a href="https://goreportcard.com/report/github.com/thazelart/golang-cli-template" rel="nofollow"><img src="https://goreportcard.com/badge/github.com/thazelart/golang-cli-template" alt="Go report card" style="max-width:100%;"></a>
</p>
Expand Down Expand Up @@ -38,9 +38,12 @@ $ go-archetype transform --transformations .go-archetype.yaml --source . --desti
# answer the questions

$ cd /path/to/destination

# init your git repository and you're done.
```

As you may have notices the `LICENSE` file is missing. Please add the according Licence file. You can find most of the licenses [here](https://github.com/licenses/license-templates/tree/master/templates).

Enjoy developing your awesome cli.

<!-- END __DO_NOT_INCLUDE__ -->
Expand Down
12 changes: 0 additions & 12 deletions cmd/root.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,5 @@
/*
Copyright © 2022 Thibault HAZELART <thazelart@gmail.com>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

// Package cmd handle the cli commands
Expand Down
12 changes: 1 addition & 11 deletions main.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,7 @@
/*
Copyright © 2022 Thibault HAZELART <thazelart@gmail.com>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Licensed under Apache 2.0 License.
*/
package main

Expand Down

0 comments on commit bc071d7

Please sign in to comment.