Merge pull request #2006 from konstantint/pattern-by-exename

feat: When running from a symlink, use the executable name as the pattern argument
This commit is contained in:
Kayvan Sylvan
2026-02-16 21:30:10 -08:00
committed by GitHub
2 changed files with 13 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
### PR [#2006](https://github.com/danielmiessler/Fabric/pull/2006) by [konstantint](https://github.com/konstantint): feat: When running from a symlink, use the executable name as the pattern argument
- Feat: When running from a symlink, use the executable name as the pattern argument

View File

@@ -161,6 +161,16 @@ func Init() (ret *Flags, err error) {
}
return
}
if ret.Pattern == "" {
execName := filepath.Base(os.Args[0])
execName = strings.TrimSuffix(execName, filepath.Ext(execName))
if execName != "fabric" && execName != "main" && execName != "cmd" && execName != "" {
ret.Pattern = execName
usedFlags["pattern"] = true
}
}
debuglog.SetLevel(debuglog.LevelFromInt(ret.Debug))
// Check to see if a ~/.config/fabric/config.yaml config file exists (only when user didn't specify a config)