3.8 KiB
3.8 KiB
gbuild — C rewrite
A C rewrite of the original gbuild bash tool. Clone, pull, pick a target, build — all from one command.
Features
- Clone or pull — automatically clones a fresh repo on first run; pulls on subsequent runs
- Interactive target picker — reads your
Makefileand presents an ncurses TUI to select the build target; pass--targetto skip it - Timestamped log files — every run writes a log to
~/.local/log/gbuild/named<timestamp>_<project>.log - Log browser — built-in two-pane TUI: file list on the left, live preview on the right; open in
less, delete, or quit - Configurable — reads
~/.gconfig; override with--urland--userat runtime gconfigcompanion — manages~/.gconfigwithinit,show, andhelpcommands
Dependencies
| Library | Purpose | Install (Debian/Ubuntu) |
|---|---|---|
| ncurses | TUI for picker & log browser | sudo apt install libncurses-dev |
| git | Clone / pull | sudo apt install git |
| make | Build projects | sudo apt install make |
| less | Open logs from browser | sudo apt install less |
Build
# Install ncurses dev headers if needed
sudo apt install libncurses-dev
# Build both binaries into bin/
make
# Optionally install system-wide
sudo make install
Quick setup
# 1. Initialise ~/.gconfig with defaults
gconfig init
# 2. Fill in your values
$EDITOR ~/.gconfig
# 3. Verify
gconfig show
# 4. Build a project
gbuild myproject
~/.gconfig format
# ~/.gconfig — managed by gconfig
[git]
GIT_URL = http://localhost:3000
GIT_USER = jokerz
[auth]
# Use token-based OR password-based auth; leave the other blank
GIT_TOKEN =
GIT_PASSWORD =
[build]
DEFAULT_TARGET =
CLONE_DIR = ~/projects
[log]
LOG_ENABLED = true
LOG_DIR = ~/.local/log/gbuild
Usage
gbuild [options] <project>
gbuild --logs
Options:
--url <url> Override Git base URL (default: ~/.gconfig)
--user <name> Override Git username (default: ~/.gconfig)
--target <tgt> Run target directly, skip interactive picker
--logs Open the interactive log browser
-h, --help Print this help and exit
Examples
# Build with defaults
gbuild myproject
# Skip the target picker
gbuild --target clean myproject
# Different server and user for this run
gbuild --url http://10.0.0.5:3000 --user alice myproject
# Browse past build logs
gbuild --logs
gconfig commands
| Command | Description |
|---|---|
gconfig init |
Create ~/.gconfig with defaults (skips if already exists) |
gconfig init --force |
Overwrite; backs up old file as ~/.gconfig.bak.<ts> |
gconfig show |
Print current config (auth fields masked) |
gconfig help |
Print usage |
Project layout
gbuild/
├── Makefile
├── README.md
├── include/
│ ├── config.h — GConfig struct, INI load/save/init/show
│ ├── git_ops.h — clone / pull
│ ├── logger.h — timestamped coloured logging
│ ├── make_ops.h — Makefile target parser + build runner
│ └── tui.h — ncurses target picker + log browser
└── src/
├── config.c
├── gbuild.c — gbuild main()
├── gconfig.c — gconfig main()
├── git_ops.c
├── logger.c
├── make_ops.c
└── tui.c
MIT License — maintained by jokerz / spdlab.hu