feat: add ^^ for last command

pull/21/head
TorchedSammy 2021-03-28 17:51:15 -04:00
parent d945d510f7
commit b735421af8
1 changed files with 9 additions and 1 deletions

10
main.go
View File

@ -101,7 +101,15 @@ func main() {
continue
}
cmdArgs := splitInput(cmdString)
// Set a variable to the command string before ^^ is
// replaced with the command before. This will be added
// to history, preventing ^^ from before being replaced.
pcmdString := cmdString
lastcmd := readline.GetHistory(readline.HistorySize() - 1)
cmdString = strings.Replace(cmdString, "^^", lastcmd, 1)
cmdArgs := splitInput(pcmdString)
if len(cmdArgs) == 0 { continue }
if aliases[cmdArgs[0]] != "" {