Skip to main content

Sindr

Project-specific commands as a CLI


cli(
    name = "sindr",
    usage = "✨🔨 Project-specific commands as a CLI. "
)

def test(ctx):
    shell('go test {{.flags}} {{.args}} ./...',
        flags='-short' if ctx.short else '')

command(
    name = "test",
    usage = "run go test",
    action = test,
    args = ['args'],
    flags = [
        {
            "name": "short",
            "type": "bool",
            "default": True,
            "usage": "Use the -short flag when running the tests"
        },
    ],
)

cli(
    name = "sindr",
    usage = "✨🔨 Project-specific commands as a CLI. "
)

def test(ctx):
    shell('go test {{.flags}} {{.args}} ./...',
        flags='-short' if ctx.short else '')

command(
    name = "test",
    usage = "run go test",
    action = test,
    args = ['args'],
    flags = [
        {
            "name": "short",
            "type": "bool",
            "default": True,
            "usage": "Use the -short flag when running the tests"
        },
    ],
)

SHORT ?= true
ARGS ?=

test:
	@if [ "$(SHORT)" = "true" ]; then \
		go test -short $(ARGS) ./...; \
	else \
		go test $(ARGS) ./...; \
	fi
.PHONY: test

help:
	@echo "Available targets:"
	@echo "  test    - run go test"
	@echo ""
	@echo "Variables:"
	@echo "  SHORT   - Use the -short flag when running the tests (default: true)"
	@echo "  ARGS    - Additional arguments to pass to go test"
	@echo ""
	@echo "Examples:"
	@echo "  make test"
	@echo "  make test SHORT=false"
	@echo "  make test ARGS='-v -race'"

SHORT ?= true
ARGS ?=

test:
	@if [ "$(SHORT)" = "true" ]; then \
		go test -short $(ARGS) ./...; \
	else \
		go test $(ARGS) ./...; \
	fi
.PHONY: test

help:
	@echo "Available targets:"
	@echo "  test    - run go test"
	@echo ""
	@echo "Variables:"
	@echo "  SHORT   - Use the -short flag when running the tests (default: true)"
	@echo "  ARGS    - Additional arguments to pass to go test"
	@echo ""
	@echo "Examples:"
	@echo "  make test"
	@echo "  make test SHORT=false"
	@echo "  make test ARGS='-v -race'"

Build a CLI

No need to learn how to use the tool, you build a CLI with flags, arguments and auto completion.

Configuration as code

No need to learn some arcane language or being restricted by a configuration language, configure your CLI by writing Starlark, a Python-subset designed for configuration.

Batteries included

Contains everything you need for your commands like running shell commands, doing async operations, caching, templating, and more.