2
2
mirror of https://github.com/Hilbis/Hilbish synced 2025-04-02 19:53:23 +00:00

feat: add ^^ for last command

This commit is contained in:
TorchedSammy 2021-03-28 17:51:15 -04:00
parent d945d510f7
commit b735421af8

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]] != "" {