mirror of
https://github.com/gopasspw/gopass.git
synced 2026-10-08 17:49:55 +02:00
Migrate the entire codebase from github.com/urfave/cli/v2 to github.com/urfave/cli/v3 (v3.9.0). Key breaking changes addressed: - cli.App removed, replaced by *cli.Command - ActionFunc signature: func(*Context) error -> func(context.Context, *Command) error - BeforeFunc signature: func(*Context) error -> func(context.Context, *Command) (context.Context, error) - app.RunContext -> app.Run - app.EnableBashCompletion -> app.EnableShellCompletion - Subcommands field renamed to Commands - EnvVars on flags -> Sources: cli.EnvVars(...) - cli.NewContext removed; test helpers updated to use cmd.Run() pattern - cli.Flag interface updated (Apply removed, Get/PreParse/PostParse/Set added) - VersionPrinter type changed to func(*Command) Also updates .capabilities.json baseline to reflect new cli/v3 call paths. Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
28 lines
484 B
Go
28 lines
484 B
Go
//go:build windows
|
|
|
|
package editor
|
|
|
|
import (
|
|
"context"
|
|
"os"
|
|
|
|
"github.com/gopasspw/gopass/internal/config"
|
|
"github.com/urfave/cli/v3"
|
|
)
|
|
|
|
// Path return the name/path of the preferred editor
|
|
func Path(ctx context.Context, cmd *cli.Command) string {
|
|
if cmd != nil {
|
|
if ed := cmd.String("editor"); ed != "" {
|
|
return ed
|
|
}
|
|
}
|
|
if ed := config.String(ctx, "edit.editor"); ed != "" {
|
|
return ed
|
|
}
|
|
if ed := os.Getenv("EDITOR"); ed != "" {
|
|
return ed
|
|
}
|
|
return "notepad.exe"
|
|
}
|