From 9ccbac70828e55b5d3eda21898e9f85cad766491 Mon Sep 17 00:00:00 2001 From: onyx-and-iris Date: Sun, 9 Mar 2025 23:18:02 +0000 Subject: [PATCH] first commit --- .github/workflows/release.yml | 31 ++++++++ .gitignore | 26 ++++++ .goreleaser.yaml | 54 +++++++++++++ CHANGELOG.md | 12 +++ LICENSE | 21 +++++ README.md | 53 +++++++++++++ Taskfile.yaml | 73 +++++++++++++++++ cmd/gen/gen.go | 53 +++++++++++++ cmd/gignore/main.go | 79 +++++++++++++++++++ cmd/gignore/util.go | 11 +++ error.go | 16 ++++ gignore.go | 69 ++++++++++++++++ go.mod | 10 +++ go.sum | 17 ++++ internal/filewriter/filewriter.go | 53 +++++++++++++ internal/registry/registry.go | 71 +++++++++++++++++ .../registry/templates/gitignoreio/.gitkeep | 0 option.go | 9 +++ 18 files changed, 658 insertions(+) create mode 100644 .github/workflows/release.yml create mode 100644 .gitignore create mode 100644 .goreleaser.yaml create mode 100644 CHANGELOG.md create mode 100644 LICENSE create mode 100644 README.md create mode 100644 Taskfile.yaml create mode 100644 cmd/gen/gen.go create mode 100644 cmd/gignore/main.go create mode 100644 cmd/gignore/util.go create mode 100644 error.go create mode 100644 gignore.go create mode 100644 go.mod create mode 100644 go.sum create mode 100644 internal/filewriter/filewriter.go create mode 100644 internal/registry/registry.go create mode 100644 internal/registry/templates/gitignoreio/.gitkeep create mode 100644 option.go diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..4429e32 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,31 @@ +name: goreleaser + +on: + push: + tags: + - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 + +permissions: + contents: write + +jobs: + goreleaser: + runs-on: ubuntu-latest + steps: + - + name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - + name: Set up Go + uses: actions/setup-go@v5 + - + name: Run GoReleaser + uses: goreleaser/goreleaser-action@v6 + with: + distribution: goreleaser + version: '~> v2' + args: release --clean + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4180dfb --- /dev/null +++ b/.gitignore @@ -0,0 +1,26 @@ +# Auto-generated .gitignore by gignore: github.com/onyx-and-iris/gignore +### Go ### +# If you prefer the allow list template instead of the deny list, see community template: +# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore +# +# Binaries for programs and plugins +*.exe +*.exe~ +*.dll +*.so +*.dylib + +# Test binary, built with `go test -c` +*.test + +# Output of the go coverage tool, specifically when used with LiteIDE +*.out + +# Dependency directories (remove the comment below to include it) +# vendor/ + +# Go workspace file +go.work +# End of gignore: github.com/onyx-and-iris/gignore + +internal/registry/templates/*/*.gitignore \ No newline at end of file diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 0000000..6f8dfb6 --- /dev/null +++ b/.goreleaser.yaml @@ -0,0 +1,54 @@ +# This is an example .goreleaser.yml file with some sensible defaults. +# Make sure to check the documentation at https://goreleaser.com + +# The lines below are called `modelines`. See `:help modeline` +# Feel free to remove those if you don't want/need to use them. +# yaml-language-server: $schema=https://goreleaser.com/static/schema.json +# vim: set ts=2 sw=2 tw=0 fo=cnqoj + +version: 2 + +before: + hooks: + # You may remove this if you don't use go modules. + - go mod tidy + # you may remove this if you don't need go generate + - go generate ./... + +builds: + - main: ./cmd/gignore/ + env: + - CGO_ENABLED=0 + goos: + - linux + - windows + - darwin + +archives: + - formats: ['tar.gz'] + # this name template makes the OS and Arch compatible with the results of `uname`. + name_template: >- + {{ .ProjectName }}_ + {{- title .Os }}_ + {{- if eq .Arch "amd64" }}x86_64 + {{- else if eq .Arch "386" }}i386 + {{- else }}{{ .Arch }}{{ end }} + {{- if .Arm }}v{{ .Arm }}{{ end }} + # use zip for windows archives + format_overrides: + - goos: windows + formats: ['zip'] + +changelog: + sort: asc + filters: + exclude: + - '^docs:' + - '^test:' + +release: + footer: >- + + --- + + Released by [GoReleaser](https://github.com/goreleaser/goreleaser). diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..884f4d2 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,12 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +# [0.1.0] - 2025-09-03 + +### Added + +- Initial release. \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..6c8dfec --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2025 Onyx and Iris + +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. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..2abf595 --- /dev/null +++ b/README.md @@ -0,0 +1,53 @@ +# Gignore - Generate .gitinore files + +## Install + +With [Task][task]: + +```bash +task install +``` + +## Usage + +```bash +Usage of gignore: + gignore [flags]