From ed45fa303c20ad255548ad74d9b090b543d2dc13 Mon Sep 17 00:00:00 2001 From: Leon Mika Date: Sun, 24 May 2026 16:27:46 +1000 Subject: [PATCH] Initial release --- .forgejo/workflows/ci.yaml | 23 ++++++++ .forgejo/workflows/release.yaml | 101 ++++++++++++++++++++++++++++++++ .gitignore | 1 + LICENSE | 0 cmd/root.go | 51 ++++++++++++++++ go.mod | 9 +++ go.sum | 11 ++++ goreleaser.yml | 83 ++++++++++++++++++++++++++ main.go | 11 ++++ 9 files changed, 290 insertions(+) create mode 100644 .forgejo/workflows/ci.yaml create mode 100644 .forgejo/workflows/release.yaml create mode 100644 .gitignore create mode 100644 LICENSE create mode 100644 cmd/root.go create mode 100644 go.mod create mode 100644 go.sum create mode 100644 goreleaser.yml create mode 100644 main.go diff --git a/.forgejo/workflows/ci.yaml b/.forgejo/workflows/ci.yaml new file mode 100644 index 0000000..850b6ef --- /dev/null +++ b/.forgejo/workflows/ci.yaml @@ -0,0 +1,23 @@ +name: CI + +on: + push: + branches: + - main + - feature/* + +jobs: + Build: + runs-on: docker + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Setup Go + uses: actions/setup-go@v3 + with: + go-version: 1.25 + - name: Test + run: | + set -xue + go get ./... + go test -p 1 ./... \ No newline at end of file diff --git a/.forgejo/workflows/release.yaml b/.forgejo/workflows/release.yaml new file mode 100644 index 0000000..26360e7 --- /dev/null +++ b/.forgejo/workflows/release.yaml @@ -0,0 +1,101 @@ +name: Release + +on: + push: + tags: + - 'v*' + +jobs: + Build: + runs-on: docker + services: + localstack: + image: localstack/localstack + ports: + - "4566:4566" + env: + SERVICES: ssm,dynamodb + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Setup Go + uses: actions/setup-go@v3 + with: + go-version: 1.25 + - name: Configure + run: | + git config --global url."https://${{ secrets.GO_MODULES_TOKEN }}:x-oauth-basic@github.com/lmika".insteadOf "https://github.com/lmika" + - name: Test + run: | + set -xue + go get ./... + go test -p 1 ./... + env: + TEST_DYNAMO_URL: "http://localstack:4566" + GOPRIVATE: "github:com/lmika/*" + + # Site: + # needs: Build + # runs-on: docker + # env: + # NETLIFY_SITE_ID: set me + # NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} + # steps: + # - name: Checkout + # uses: actions/checkout@v2 + # - name: Setup Go + # uses: actions/setup-go@v3 + # with: + # go-version: 1.24 + # - uses: actions/setup-node@v4 + # with: + # node-version: 21.1 + # - name: Install Hugo + # run: | + # curl -LO https://github.com/gohugoio/hugo/releases/download/v0.146.0/hugo_extended_0.146.0_linux-amd64.deb + # apt install -y ./hugo_extended_0.146.0_linux-amd64.deb + # - name: Install Netlify CLI + # run: | + # npm install netlify-cli@15.0.1 -g + # - name: Build Site + # run: | + # cd _site + # mkdir -p themes + # git clone https://github.com/alex-shpak/hugo-book.git themes/hugo-book + # npm install + # hugo --minify + # - name: Publish Site + # run: | + # cd _site + # netlify deploy --dir docs --prod + + 'Release MacOS': + # needs: Build + runs-on: macos + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Setup Go + uses: actions/setup-go@v3 + with: + go-version: 1.25 + - name: Setup Dependencies + run: | + brew install gpg + - name: Configure + run: | + git config --global url."https://${{ secrets.GO_MODULES_TOKEN }}:x-oauth-basic@github.com/lmika".insteadOf "https://github.com/lmika" + - name: Setup Goreleaser + run: | + go install github.com/goreleaser/goreleaser/v2@v2.12.7 + - name: Release + run: | + goreleaser release -f goreleaser.yml --skip=validate --clean + env: + GITEA_TOKEN: ${{ secrets.GITHUB_TOKEN }} + HOMEBREW_TAP_PRIVATE_KEY: ${{ secrets.HOMEBREW_TAP_PRIVATE_KEY }} + MACOS_SIGN_P12: ${{ secrets.MACOS_SIGN_P12 }} + MACOS_SIGN_PASSWORD: ${{ secrets.MACOS_SIGN_PASSWORD }} + MACOS_NOTARY_KEY: ${{ secrets.MACOS_NOTARY_KEY }} + MACOS_NOTARY_KEY_ID: ${{ secrets.MACOS_NOTARY_KEY_ID }} + MACOS_NOTARY_ISSUER_ID: ${{ secrets.MACOS_NOTARY_ISSUER_ID }} \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9f11b75 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.idea/ diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..e69de29 diff --git a/cmd/root.go b/cmd/root.go new file mode 100644 index 0000000..bab4a81 --- /dev/null +++ b/cmd/root.go @@ -0,0 +1,51 @@ +/* +Copyright © 2026 NAME HERE + +*/ +package cmd + +import ( + "os" + + "github.com/spf13/cobra" +) + + + +// rootCmd represents the base command when called without any subcommands +var rootCmd = &cobra.Command{ + Use: "csvutils", + Short: "A brief description of your application", + Long: `A longer description that spans multiple lines and likely contains +examples and usage of using your application. For example: + +Cobra is a CLI library for Go that empowers applications. +This application is a tool to generate the needed files +to quickly create a Cobra application.`, + // Uncomment the following line if your bare application + // has an action associated with it: + // Run: func(cmd *cobra.Command, args []string) { }, +} + +// Execute adds all child commands to the root command and sets flags appropriately. +// This is called by main.main(). It only needs to happen once to the rootCmd. +func Execute() { + err := rootCmd.Execute() + if err != nil { + os.Exit(1) + } +} + +func init() { + // Here you will define your flags and configuration settings. + // Cobra supports persistent flags, which, if defined here, + // will be global for your application. + + // rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.csvutils.yaml)") + + // Cobra also supports local flags, which will only run + // when this action is called directly. + rootCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle") +} + + diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..d6f3636 --- /dev/null +++ b/go.mod @@ -0,0 +1,9 @@ +module lmika.dev/cmd/csvutils + +go 1.26.3 + +require ( + github.com/inconshreveable/mousetrap v1.1.0 // indirect + github.com/spf13/cobra v1.10.2 // indirect + github.com/spf13/pflag v1.0.10 // indirect +) diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..ef5d78d --- /dev/null +++ b/go.sum @@ -0,0 +1,11 @@ +github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= +github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= +github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/spf13/cobra v1.10.2 h1:DMTTonx5m65Ic0GOoRY2c16WCbHxOOw6xxezuLaBpcU= +github.com/spf13/cobra v1.10.2/go.mod h1:7C1pvHqHw5A4vrJfjNwvOdzYu0Gml16OCs2GRiTUUS4= +github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk= +github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/goreleaser.yml b/goreleaser.yml new file mode 100644 index 0000000..6b3314d --- /dev/null +++ b/goreleaser.yml @@ -0,0 +1,83 @@ +version: 2 + +builds: + - id: macos + targets: + - darwin_amd64 + - darwin_arm64 + env: + - CGO_ENABLED=0 + main: . + binary: csvutils + - id: linux + targets: + - linux_amd64 + - linux_arm64 + env: + - CGO_ENABLED=0 + main: . + binary: ted + +notarize: + macos: + - enabled: true + ids: + - macos + sign: + certificate: "{{.Env.MACOS_SIGN_P12}}" + password: "{{.Env.MACOS_SIGN_PASSWORD}}" + notarize: + issuer_id: "{{.Env.MACOS_NOTARY_ISSUER_ID}}" + key_id: "{{.Env.MACOS_NOTARY_KEY_ID}}" + key: "{{.Env.MACOS_NOTARY_KEY}}" + wait: true + timeout: 20m + +archives: + - id: macos_tgz + ids: + - macos + wrap_in_directory: false + formats: + - tar.gz + - id: linux_tgz + ids: + - linux + wrap_in_directory: false + formats: + - tar.gz + +release: + gitea: + owner: cmd + name: ted + ids: + - macos_tgz + - linux_tgz + +homebrew_casks: + - name: csvutils + ids: + - macos + repository: + owner: casks + name: dynamo-browse + git: + url: 'forgejo@lmika.dev:casks/ted.git' + private_key: "{{ .Env.HOMEBREW_TAP_PRIVATE_KEY }}" + directory: Casks + homepage: https://ted.lmika.dev/ + description: TUI tools for working with CSV files + license: MIT + +checksum: + name_template: 'checksums-macos.txt' + +snapshot: + version_template: "{{ .Tag }}-next" + +gitea_urls: + api: https://lmika.dev/api/v1 + download: https://lmika.dev + # set to true if you use a self-signed certificate + skip_tls_verify: false \ No newline at end of file diff --git a/main.go b/main.go new file mode 100644 index 0000000..5dad208 --- /dev/null +++ b/main.go @@ -0,0 +1,11 @@ +/* +Copyright © 2026 NAME HERE + +*/ +package main + +import "lmika.dev/cmd/csvutils/cmd" + +func main() { + cmd.Execute() +}