57 lines
1.7 KiB
Go
57 lines
1.7 KiB
Go
// Command setup installs sherlock and its MCP binaries. It is the
|
|
// bootstrap entry point — run it from a clone of the repo:
|
|
//
|
|
// git clone https://gitea.alexandru.macocian.me/amacocian/sherlock.git
|
|
// cd sherlock
|
|
// go run ./setup
|
|
//
|
|
// It clones (or updates) the source under ${XDG_CACHE_HOME:-~/.cache}/
|
|
// sherlock/src, checks out the latest release tag, seeds your config
|
|
// (opening $EDITOR), then builds and installs every binary with the
|
|
// release version baked in, plus shell completions. The same logic
|
|
// backs `sherlock update`; there is no duplicate install path.
|
|
//
|
|
// Flags:
|
|
//
|
|
// -y, --yes skip the editor step (config already filled in)
|
|
// --config-only set up/edit the config but do not build/install
|
|
// --local build from THIS checkout instead of the cache clone
|
|
// -h, --help show this help
|
|
package main
|
|
|
|
import (
|
|
"context"
|
|
"flag"
|
|
"fmt"
|
|
"os"
|
|
"os/signal"
|
|
"syscall"
|
|
|
|
"gitea.alexandru.macocian.me/amacocian/sherlock/internal/installer"
|
|
)
|
|
|
|
func main() {
|
|
yes := flag.Bool("y", false, "skip the editor step (config already filled in)")
|
|
flag.BoolVar(yes, "yes", false, "skip the editor step (config already filled in)")
|
|
configOnly := flag.Bool("config-only", false, "set up/edit the config but do not build/install")
|
|
local := flag.Bool("local", false, "build from this checkout instead of cloning to the cache")
|
|
flag.Parse()
|
|
|
|
wd, _ := os.Getwd()
|
|
|
|
ctx, cancel := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM)
|
|
defer cancel()
|
|
|
|
err := installer.Install(ctx, installer.Options{
|
|
Local: *local,
|
|
LocalDir: wd,
|
|
SeedConfig: true,
|
|
OpenEditor: !*yes,
|
|
ConfigOnly: *configOnly,
|
|
})
|
|
if err != nil {
|
|
fmt.Fprintln(os.Stderr, "setup:", err)
|
|
os.Exit(1)
|
|
}
|
|
}
|