mirror of
https://github.com/bettercap/bettercap
synced 2025-07-06 21:12:05 -07:00
new: history file location can now be set via BETTERCAP_HISTORY env var (closes #627)
This commit is contained in:
parent
9e7fda751a
commit
93de427f9a
2 changed files with 7 additions and 2 deletions
|
@ -30,7 +30,8 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
HistoryFile = "~/bettercap.history"
|
DefaultHistoryFile = "~/bettercap.history"
|
||||||
|
HistoryEnvVar = "BETTERCAP_HISTORY"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
|
@ -72,7 +72,11 @@ func (s *Session) setupReadline() (err error) {
|
||||||
|
|
||||||
history := ""
|
history := ""
|
||||||
if !*s.Options.NoHistory {
|
if !*s.Options.NoHistory {
|
||||||
history, _ = fs.Expand(HistoryFile)
|
histPath := DefaultHistoryFile
|
||||||
|
if fromEnv := os.Getenv(HistoryEnvVar); fromEnv != "" {
|
||||||
|
histPath = fromEnv
|
||||||
|
}
|
||||||
|
history, _ = fs.Expand(histPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
cfg := readline.Config{
|
cfg := readline.Config{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue