dbcli / litecli

CLI for SQLite Databases with auto-completion and syntax highlighting
https://litecli.com
BSD 3-Clause "New" or "Revised" License
2.09k stars 67 forks source link

Allow for auto casing of SQL functions #106

Closed soupglasses closed 3 years ago

soupglasses commented 3 years ago

One of my biggest pet peeves with working with SQL is that i have to hold down my shift key so much to write a statement like CREATE table IF NOT EXISTS .... I could learn myself to use the tab key, but the frustration is still there of having to micromanage my casing.

This is a feature request where one could write select * from table where id = 1 and the program would auto case the SQL words to your preferred casing as you go. So select * from table where id = 1 would become SELECT * FROM table WHERE id = 1

My idea would be to trigger this auto casing functionality after the completion of a word by hitting space or ending with a ;.

Written example of how it could work while typing:

... whe wher where WHERE WHERE i WHERE id ...

You can currently mimmic this type of autocasing by using autocompletion and hitting TAB when you only have one character left of a SQL word. But this does not help much with the issue of micromanaging. As now you have to think about stopping yourself from writing the full word and hitting tab. Rather than just writing the SQL statement you had in mind.

amjith commented 3 years ago

@imsofi You can set the casing for the completion to be upper case in the config file (located in ~/.config/litecli/config).

https://github.com/dbcli/litecli/blob/master/litecli/liteclirc#L79

That still isn't going to solve the exact scenario you're wanting but that is the closest we can do.