Files
simplegit/cmd/main.go
T
2026-07-17 05:55:31 -04:00

56 lines
979 B
Go

package main
import (
"fmt"
"os"
"simplegit/cmd/daemon"
"simplegit/cmd/gitctl"
"simplegit/hooks"
)
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 "hook":
hooks.RunClient(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 hook [flags] forward a git hook invocation (run by hook scripts)
simplegit help show this help
Run "simplegit daemon -h" or "simplegit ctl -h" for subcommand flags.
`)
}