It's perhaps worth mentioning the smaller and more liberally licensed editline library if you want to embed the same line-editing functionality in your own CLI. It's been used in non-GNU Unixes for decades.
https://troglobit.com/projects/editline/
See also the note at the bottom of that page about other versions of editline/libedit.