complete fgj → fj rename: env vars, config migration, docs
Some checks are pending
CI / lint (push) Waiting to run
CI / build (push) Waiting to run
CI / test (push) Waiting to run
CI / functional (push) Blocked by required conditions

- Rename env vars: FGJ_HOST → FJ_HOST, FGJ_TOKEN → FJ_TOKEN,
  FGJ_FORCE_TTY → FJ_FORCE_TTY, FGJ_PAGER → FJ_PAGER,
  FGJ_BINARY_PATH → FJ_BINARY_PATH (all with legacy fallback)
- Auto-migrate ~/.config/fgj/ → ~/.config/fj/ on first run
- Update man page title, README, CHANGELOG
- Update test fixture labels from [FGJ E2E Test] to [FJ E2E Test]
This commit is contained in:
sid 2026-04-26 08:23:48 -06:00
parent cf7c0e0878
commit c3e8ad67ed
9 changed files with 94 additions and 33 deletions

View file

@ -131,7 +131,7 @@ func (c *Config) SaveToPath(path string) error {
// Priority order:
// 1. Explicitly provided hostname parameter
// 2. CLI flag (--hostname)
// 3. Environment variable (FGJ_HOST)
// 3. Environment variable (FJ_HOST, with FGJ_HOST fallback)
// 4. Auto-detected hostname from git remote
// 5. match_dirs lookup (longest prefix match)
// 6. Default to codeberg.org
@ -141,7 +141,7 @@ func (c *Config) GetHost(hostname string, detectedHost string, cwd string) (Host
}
if hostname == "" {
hostname = os.Getenv("FGJ_HOST")
hostname = EnvWithFallback("FJ_HOST", "FGJ_HOST")
}
if hostname == "" {
@ -228,6 +228,15 @@ func (c *Config) ResolveHostByPath(cwd string) string {
}
// expandHome replaces a leading ~ with the user's home directory.
// EnvWithFallback returns the value of the primary env var, falling back to
// the legacy name if the primary is unset. This eases the FGJ_ → FJ_ rename.
func EnvWithFallback(primary, legacy string) string {
if v := os.Getenv(primary); v != "" {
return v
}
return os.Getenv(legacy)
}
func expandHome(path string) string {
if path == "~" || strings.HasPrefix(path, "~/") {
home, err := os.UserHomeDir()