mirror of
https://github.com/danielmiessler/Fabric.git
synced 2026-02-19 10:14:21 -05:00
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:
3
cmd/generate_changelog/incoming/2006.txt
Normal file
3
cmd/generate_changelog/incoming/2006.txt
Normal 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
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user