1 hour ago · Tech · 0 comments

The last week was a bit chaotic. Our dog Triss had TPLO surgery, so my days mostly consisted of holding her paw in the morning, working while Jean holds her paw, and then going to sleep. But I could sneak some fun project time in and started implementing autocomplete in my shell. Which is not even remotely complete, but it works for paths, which is something. Initially I was a bit too clever trying to cache a lot of the information, but I opted to simply redo all the work, like reading a directory and deciding which completion candidates to have on each press of the tab key. I might revisit this later, but for now it is good enough. Working on autocomplete also was a reminder how many things a regular shell does you usually do not think about, like expanding ~ to your home directory. if strings.HasPrefix(c.cmd, "~") { if home, err := os.UserHomeDir(); err == nil { c.cmd = strings.Replace(c.cmd, "~", home, 1) } else { fmt.Fprintln(os.Stderr, err.Error()) } } The first thing to figure…

No comments yet. Log in to reply on the Fediverse. Comments will appear here.