No results
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
gofmtbefore committing (gofmt -w .) - Run
go vet ./...— zero warnings expected - No external dependencies — the standard library only
Bash:
set -euo pipefailis required at the top- All variables must be quoted
- Use
localfor all function-scoped variables - Avoid bashisms that break on bash 4.0
Adding a New Command
Go edition (app.go)
- Add a
case "mycommand":branch inApp.Run(). - Implement
func (a *App) cmdMyCommand(args []string) error. - Add a help line in
cmdHelp().
Bash edition (nt.sh)
- Add a
mycommand)case in thecase "$cmd"block at the bottom. - Implement
cmd_mycommand(). - 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
- Fork the repository.
- Create a branch:
git checkout -b feat/my-feature. - Commit your changes with a clear message.
- Open a pull request with a description of what changed and why.