s
This commit is contained in:
@@ -7,15 +7,11 @@
|
||||
|
||||
GOFLAGS := -trimpath
|
||||
|
||||
.PHONY: build gitctl test clean proto proto-tools proto-check
|
||||
.PHONY: build test clean proto proto-tools proto-check
|
||||
|
||||
# build the simplegit server into ./build.
|
||||
build:
|
||||
go build $(GOFLAGS) -o daemon ./cmd/daemon
|
||||
|
||||
# build the ManageService TUI client into ./build.
|
||||
gitctl:
|
||||
go build $(GOFLAGS) -o gitctl ./cmd/gitctl
|
||||
go build $(GOFLAGS) -o simplegit ./cmd
|
||||
|
||||
# run all tests.
|
||||
test:
|
||||
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
// simplegit is the single entry point for the simplegit git-hosting server and
|
||||
// its management TUI. The two used to be separate binaries (cmd/daemon and
|
||||
// cmd/gitctl); they are now subcommands of one binary.
|
||||
//
|
||||
// simplegit daemon run the git hosting server (HTTP + SSH + manage)
|
||||
// simplegit ctl run the gitctl TUI against the manage port
|
||||
// simplegit (no args, or any other subcommand) print help
|
||||
//
|
||||
// Each subcommand owns its own flag set, so flags are parsed after the
|
||||
// subcommand is selected: `simplegit daemon -skip-auth`, `simplegit ctl -manage ...`.
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"simplegit/cmd/daemon"
|
||||
"simplegit/cmd/gitctl"
|
||||
)
|
||||
|
||||
func main() {
|
||||
args := os.Args[1:]
|
||||
if len(args) == 0 {
|
||||
printHelp(os.Stdout)
|
||||
return
|
||||
}
|
||||
switch args[0] {
|
||||
case "daemon":
|
||||
daemon.Run(args[1:])
|
||||
case "ctl":
|
||||
gitctl.Run(args[1:])
|
||||
case "help", "-h", "--help":
|
||||
printHelp(os.Stdout)
|
||||
default:
|
||||
fmt.Fprintf(os.Stderr, "simplegit: unknown subcommand %q\n\n", args[0])
|
||||
printHelp(os.Stderr)
|
||||
os.Exit(2)
|
||||
}
|
||||
}
|
||||
|
||||
func printHelp(w *os.File) {
|
||||
fmt.Fprint(w, `simplegit - minimal git hosting server + management TUI
|
||||
|
||||
Usage:
|
||||
simplegit daemon [flags] run the git hosting server (HTTP + SSH + manage)
|
||||
simplegit ctl [flags] run the gitctl TUI against the manage port
|
||||
simplegit help show this help
|
||||
|
||||
Run "simplegit daemon -h" or "simplegit ctl -h" for subcommand flags.
|
||||
`)
|
||||
}
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
#
|
||||
# Assumes the backend is already listening at $BASE (default :8091). Start it
|
||||
# in another terminal, e.g.:
|
||||
# go run ./cmd -root /tmp/sgtest -http :8091 -ssh :2222
|
||||
# go run ./cmd daemon -root /tmp/sgtest -rpc :8091 -ssh :2222
|
||||
# then run:
|
||||
# ./tests/api_e2e.sh
|
||||
#
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@ trap 'rm -rf "$WORK"; [ -n "$SG_PID" ] && kill "$SG_PID" 2>/dev/null' EXIT
|
||||
mkdir -p "$ROOT"
|
||||
|
||||
# --- start simplegit (skip-auth: anon read+write, no console needed) ---
|
||||
"$BIN" -rpc "$RPC" -ssh "" -root "$ROOT" -skip-auth >"$WORK/sg.log" 2>&1 &
|
||||
"$BIN" daemon -rpc "$RPC" -ssh "" -root "$ROOT" -skip-auth >"$WORK/sg.log" 2>&1 &
|
||||
SG_PID=$!
|
||||
|
||||
# wait until the HTTP port answers
|
||||
|
||||
Reference in New Issue
Block a user