diff options
| author | Paul Buetow <paul@buetow.org> | 2026-05-02 11:41:44 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-05-02 11:41:55 +0300 |
| commit | 266bedf71fe8a54b86af038889522a68bae562a8 (patch) | |
| tree | 6ca2b100e63ea5b4e746e71b2b79b626ba70c597 /internal/hexaicli/runner.go | |
| parent | d9184a5bfdc39d40232cb0d66a350daffcd7a326 (diff) | |
Drop hexai edit; document hexai config only.v0.38.4
The CLI now opens the config file only via hexai config (and --config).
README, usage, and configuration docs describe the subcommand. Version 0.38.4.
Co-authored-by: Cursor <cursoragent@cursor.com>
Diffstat (limited to 'internal/hexaicli/runner.go')
| -rw-r--r-- | internal/hexaicli/runner.go | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/internal/hexaicli/runner.go b/internal/hexaicli/runner.go index f372021..eaae1cd 100644 --- a/internal/hexaicli/runner.go +++ b/internal/hexaicli/runner.go @@ -67,6 +67,31 @@ func NewRunner() *Runner { func (r *Runner) Run(ctx context.Context, args []string, stdin io.Reader, stdout, stderr io.Writer) error { runner := normalizeRunner(r) + if len(args) > 0 { + sub := args[0] + if sub == "config" { + if len(args) > 1 { + err := fmt.Errorf(`hexai %s: unexpected arguments (use only %q)`, sub, sub) + _, _ = fmt.Fprintf(stderr, logging.AnsiBase+"%v"+logging.AnsiReset+"\n", err) + return err + } + cfgPath := strings.TrimSpace(configPathFromContext(ctx)) + if cfgPath == "" { + p, pathErr := appconfig.ConfigPath() + if pathErr != nil { + err := fmt.Errorf("hexai %s: %w", sub, pathErr) + _, _ = fmt.Fprintf(stderr, logging.AnsiBase+"%v"+logging.AnsiReset+"\n", err) + return err + } + cfgPath = p + } + if err := editor.OpenFile(cfgPath); err != nil { + _, _ = fmt.Fprintf(stderr, logging.AnsiBase+"hexai %s: %v"+logging.AnsiReset+"\n", sub, err) + return err + } + return nil + } + } if spec, ok, err := tpsSimulationFromContext(ctx); err != nil { _, _ = fmt.Fprintln(stderr, logging.AnsiBase+err.Error()+logging.AnsiReset) return err |
