Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: CI

on:
push:
branches:
- main
pull_request:

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: '1.24.2'

- name: golangci-lint
uses: golangci/golangci-lint-action@v8
with:
version: v2.1.6

- name: Run testing
run: go test -v

- name: Run the scripts
run: |
GOOS=darwin GOARCH=arm64 go build -o ./build/dist/mbx_darwin_arm64 .
GOOS=darwin GOARCH=amd64 go build -o ./build/dist/mbx_darwin_amd64 .
GOOS=linux GOARCH=amd64 go build -o ./build/dist/mbx_linux_amd64 .
GOOS=linux GOARCH=arm64 go build -o ./build/dist/mbx_linux_arm64 .

2 changes: 2 additions & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
golang 1.24.2
golangci-lint 2.1.6
9 changes: 0 additions & 9 deletions .travis.yml

This file was deleted.

117 changes: 117 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
# Makefile for Go Project

# ==============================================================================
# Variables
# ==============================================================================

# Binary name (default: name of the current directory)
BINARY_NAME = mbx

# Output directory for the binary
BUILD_OUTPUT_DIR = ./build/dist

# Go command
GO_CMD ?= go

# GolangCI-Lint command
# Assumes golangci-lint is in the PATH. If not, provide the full path.
GOLANGCI_LINT_CMD ?= golangci-lint

# Go build flags (e.g., -ldflags="-s -w" to strip symbols and debug info)
# Example: GO_BUILD_FLAGS = -ldflags="-X main.Version=1.0.0"
GO_BUILD_FLAGS ?=

# Go test flags (e.g., -v for verbose, -race for race detector)
GO_TEST_FLAGS ?= -v

# Packages to include in build/test etc. (default: all packages in the current module)
# Note: golangci-lint typically uses ./... by default, but we keep the variable for consistency
PACKAGES ?= ./...

# ==============================================================================
# Targets
# ==============================================================================

.PHONY: all build run test cover clean deps fmt lint help

# Default target: builds the project
all: build

# Build the Go application
# Creates the binary in the specified BUILD_OUTPUT_DIR
build: deps
@echo "==> Building $(BINARY_NAME)..."
@mkdir -p $(BUILD_OUTPUT_DIR)
$(GO_CMD) build $(GO_BUILD_FLAGS) -o $(BUILD_OUTPUT_DIR)/$(BINARY_NAME) .

build-multi: deps
@echo "==> Building $(BINARY_NAME)..."
@mkdir -p $(BUILD_OUTPUT_DIR)
GOOS=darwin GOARCH=arm64 $(GO_CMD) build $(GO_BUILD_FLAGS) -o $(BUILD_OUTPUT_DIR)/$(BINARY_NAME)_darwin_arm64 .
GOOS=darwin GOARCH=amd64 $(GO_CMD) build $(GO_BUILD_FLAGS) -o $(BUILD_OUTPUT_DIR)/$(BINARY_NAME)_darwin_amd64 .
GOOS=linux GOARCH=amd64 $(GO_CMD) build $(GO_BUILD_FLAGS) -o $(BUILD_OUTPUT_DIR)/$(BINARY_NAME)_linux_amd64 .
GOOS=linux GOARCH=arm64 $(GO_CMD) build $(GO_BUILD_FLAGS) -o $(BUILD_OUTPUT_DIR)/$(BINARY_NAME)_linux_arm64 .

# Run the Go application
# Assumes the main package is in the current directory or specified by PACKAGES if it's a single package
run: build
@echo "==> Running $(BINARY_NAME)..."
$(BUILD_OUTPUT_DIR)/$(BINARY_NAME)

# Run tests
test: deps
@echo "==> Running tests..."
$(GO_CMD) test $(GO_TEST_FLAGS) $(PACKAGES)

# Run tests with coverage report
cover: deps
@echo "==> Running tests with coverage..."
$(GO_CMD) test $(GO_TEST_FLAGS) -coverprofile=coverage.out $(PACKAGES)
@echo "==> Generating coverage report (coverage.html)..."
$(GO_CMD) tool cover -html=coverage.out -o coverage.html

# Clean build artifacts and coverage files
clean:
@echo "==> Cleaning..."
@rm -rf $(BUILD_OUTPUT_DIR)
@rm -f coverage.out coverage.html

# Tidy dependencies (download new, remove unused)
deps:
@echo "==> Tidying dependencies..."
$(GO_CMD) mod tidy
$(GO_CMD) mod download # Optional: ensures all deps are downloaded

# Format Go code
fmt:
@echo "==> Formatting code..."
$(GO_CMD) fmt $(PACKAGES)

# Run golangci-lint linter
# Assumes golangci-lint is installed (go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest)
# It will use the configuration file (.golangci.yml, .golangci.toml, or .golangci.json) if present.
lint: deps
@echo "==> Running golangci-lint..."
$(GOLANGCI_LINT_CMD) run $(PACKAGES)

# Display help message
help:
@echo "Usage: make [target]"
@echo ""
@echo "Targets:"
@echo " all Build the application (default)"
@echo " build Compile the application"
@echo " run Compile and run the application"
@echo " test Run tests"
@echo " cover Run tests and generate HTML coverage report"
@echo " clean Remove build artifacts and coverage files"
@echo " deps Tidy and download dependencies"
@echo " fmt Format Go source code"
@echo " lint Run golangci-lint linter"
@echo " help Show this help message"
@echo ""
@echo "Variables:"
@echo " GOLANGCI_LINT_CMD Command to run golangci-lint (default: golangci-lint)"
@echo " GO_BUILD_FLAGS Flags for 'go build' (e.g., -ldflags='...') "
@echo " GO_TEST_FLAGS Flags for 'go test' (e.g., -v -race)"
@echo " PACKAGES Packages to target (default: ./...)"
32 changes: 0 additions & 32 deletions build.gradle

This file was deleted.

32 changes: 32 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
module github.com/vanroy/microcli

go 1.24.2

require github.com/urfave/cli/v3 v3.3.2

require github.com/c-bata/go-prompt v0.2.6

require github.com/thoas/go-funk v0.9.3

require github.com/go-resty/resty/v2 v2.16.5

require github.com/BurntSushi/toml v1.4.0

require github.com/gobwas/glob v0.2.2

require github.com/zalando/go-keyring v0.2.6

require golang.org/x/term v0.31.0

require (
al.essio.dev/pkg/shellescape v1.5.1 // indirect
github.com/danieljoos/wincred v1.2.2 // indirect
github.com/godbus/dbus/v5 v5.1.0 // indirect
github.com/mattn/go-colorable v0.1.7 // indirect
github.com/mattn/go-isatty v0.0.12 // indirect
github.com/mattn/go-runewidth v0.0.9 // indirect
github.com/mattn/go-tty v0.0.3 // indirect
github.com/pkg/term v1.2.0-beta.2 // indirect
golang.org/x/net v0.33.0 // indirect
golang.org/x/sys v0.32.0 // indirect
)
67 changes: 67 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
al.essio.dev/pkg/shellescape v1.5.1 h1:86HrALUujYS/h+GtqoB26SBEdkWfmMI6FubjXlsXyho=
al.essio.dev/pkg/shellescape v1.5.1/go.mod h1:6sIqp7X2P6mThCQ7twERpZTuigpr6KbZWtls1U8I890=
github.com/BurntSushi/toml v1.4.0 h1:kuoIxZQy2WRRk1pttg9asf+WVv6tWQuBNVmK8+nqPr0=
github.com/BurntSushi/toml v1.4.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho=
github.com/c-bata/go-prompt v0.2.6 h1:POP+nrHE+DfLYx370bedwNhsqmpCUynWPxuHi0C5vZI=
github.com/c-bata/go-prompt v0.2.6/go.mod h1:/LMAke8wD2FsNu9EXNdHxNLbd9MedkPnCdfpU9wwHfY=
github.com/danieljoos/wincred v1.2.2 h1:774zMFJrqaeYCK2W57BgAem/MLi6mtSE47MB6BOJ0i0=
github.com/danieljoos/wincred v1.2.2/go.mod h1:w7w4Utbrz8lqeMbDAK0lkNJUv5sAOkFi7nd/ogr0Uh8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/go-resty/resty/v2 v2.16.5 h1:hBKqmWrr7uRc3euHVqmh1HTHcKn99Smr7o5spptdhTM=
github.com/go-resty/resty/v2 v2.16.5/go.mod h1:hkJtXbA2iKHzJheXYvQ8snQES5ZLGKMwQ07xAwp/fiA=
github.com/gobwas/glob v0.2.2 h1:czsC5u90AkrSujyGY0l7ST7QVLEPrdoMoXxRx/hXgq0=
github.com/gobwas/glob v0.2.2/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8=
github.com/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk=
github.com/godbus/dbus/v5 v5.1.0/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 h1:El6M4kTTCOh6aBiKaUGG7oYTSPP8MxqL4YI3kZKwcP4=
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ=
github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
github.com/mattn/go-colorable v0.1.7 h1:bQGKb3vps/j0E9GfJQ03JyhRuxsvdAanXlT9BTw3mdw=
github.com/mattn/go-colorable v0.1.7/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84=
github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
github.com/mattn/go-runewidth v0.0.6/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0=
github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
github.com/mattn/go-tty v0.0.3 h1:5OfyWorkyO7xP52Mq7tB36ajHDG5OHrmBGIS/DtakQI=
github.com/mattn/go-tty v0.0.3/go.mod h1:ihxohKRERHTVzN+aSVRwACLCeqIoZAWpoICkkvrWyR0=
github.com/pkg/term v1.2.0-beta.2 h1:L3y/h2jkuBVFdWiJvNfYfKmzcCnILw7mJWm2JQuMppw=
github.com/pkg/term v1.2.0-beta.2/go.mod h1:E25nymQcrSllhX42Ok8MRm1+hyBdHY0dCeiKZ9jpNGw=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY=
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/thoas/go-funk v0.9.3 h1:7+nAEx3kn5ZJcnDm2Bh23N2yOtweO14bi//dvRtgLpw=
github.com/thoas/go-funk v0.9.3/go.mod h1:+IWnUfUmFO1+WVYQWQtIJHeRRdaIyyYglZN7xzUPe4Q=
github.com/urfave/cli/v3 v3.3.2 h1:BYFVnhhZ8RqT38DxEYVFPPmGFTEf7tJwySTXsVRrS/o=
github.com/urfave/cli/v3 v3.3.2/go.mod h1:FJSKtM/9AiiTOJL4fJ6TbMUkxBXn7GO9guZqoZtpYpo=
github.com/zalando/go-keyring v0.2.6 h1:r7Yc3+H+Ux0+M72zacZoItR3UDxeWfKTcabvkI8ua9s=
github.com/zalando/go-keyring v0.2.6/go.mod h1:2TCrxYrbUNYfNS/Kgy/LSrkSQzZ5UPVH85RwfczwvcI=
golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I=
golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4=
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200909081042-eff7692f9009/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200918174421-af09f7315aff/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.32.0 h1:s77OFDvIQeibCmezSnk/q6iAfkdiQaJi4VzroCFrN20=
golang.org/x/sys v0.32.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
golang.org/x/term v0.31.0 h1:erwDkOK1Msy6offm1mOgvspSkslFnIGsFnxOKoufg3o=
golang.org/x/term v0.31.0/go.mod h1:R4BeIy7D95HzImkxGkTW1UQTtP54tio2RyHz7PwK0aw=
golang.org/x/time v0.6.0 h1:eTDhh4ZXt5Qf0augr54TN6suAUudPcawVZeIAPU7D4U=
golang.org/x/time v0.6.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
Binary file removed gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
6 changes: 0 additions & 6 deletions gradle/wrapper/gradle-wrapper.properties

This file was deleted.

Loading