1 Contributing
riomoo edited this page 2026-04-08 18:34:42 -04:00

Contributing

Contributions are welcome. Please open an issue before submitting a large change so the approach can be discussed first.


Repository Layout

.
├── bash/
│   └── nt.sh              ← Bash edition (single file)
├── cmd/
│   └── nt/
│       └── main.go        ← Go entry point
├── docs/
│   └── images/
│       └── svgs/          ← Badge SVGs
├── internal/
│   └── notes/
│       └── app.go         ← All commands and rendering (Go)
├── go.mod
├── Makefile
├── LICENSE
└── README.md

Building the Go Edition

# Build for the current platform
go build -o nt ./cmd/nt

# Install to /usr/local/bin
make install

# Cross-compile (example: Linux ARM64)
GOOS=linux GOARCH=arm64 go build -o nt-linux-arm64 ./cmd/nt

Running Tests

go test ./...

The Bash edition can be tested manually or with bats-core:

bats tests/

Code Style

Go:

  • Run gofmt before committing (gofmt -w .)
  • Run go vet ./... — zero warnings expected
  • No external dependencies — the standard library only

Bash:

  • set -euo pipefail is required at the top
  • All variables must be quoted
  • Use local for all function-scoped variables
  • Avoid bashisms that break on bash 4.0

Adding a New Command

Go edition (app.go)

  1. Add a case "mycommand": branch in App.Run().
  2. Implement func (a *App) cmdMyCommand(args []string) error.
  3. Add a help line in cmdHelp().

Bash edition (nt.sh)

  1. Add a mycommand) case in the case "$cmd" block at the bottom.
  2. Implement cmd_mycommand().
  3. Add a help line in cmd_help().

Both editions must be updated together to maintain feature parity.


Commit Messages

Follow the existing style used by auto-commits:

add: short description of what was added
fix: short description of what was fixed
refactor: short description
docs: wiki or README updates

Submitting Changes

  1. Fork the repository.
  2. Create a branch: git checkout -b feat/my-feature.
  3. Commit your changes with a clear message.
  4. Open a pull request with a description of what changed and why.