skate icon indicating copy to clipboard operation
skate copied to clipboard

feat: add suggestions

Open bashbunni opened this issue 1 year ago • 5 comments

builds off of the delete-db PR. Suggests a db name that does exist based on the first two characters of a mistyped arg. Just kept it simple, but would be great to hear if there are better ways to do this. I also experimented with having a more reusable function for getting the []os.DirEntry for a default client.

Would also love some guidance on how I could write tests for this 💭

bashbunni avatar May 30 '23 15:05 bashbunni

Hmmm tests are making CI fail with /home/runner/.local/share/charm/cloud.charm.sh/kv: no such file or directory.

Open to suggestions on how to make it more stable :)

bashbunni avatar May 31 '23 21:05 bashbunni

Yeah, so my tests are making the Ubuntu build fail... Going to need to change the path to a temp dir with an env variable (CHARM_DATA_DIR=<path-to-temp-dir>) for tests to pass? Gonna check it out

bashbunni avatar Jun 07 '23 19:06 bashbunni

noice!

caarlos0 avatar Jun 08 '23 16:06 caarlos0

Not sure if I should also add a check for reflect.DeepEqual on the suggestions we get back 🤔. Not sure that ordering is consistent... Will check if it changes anything locally, so don't merge yet pls 😄

bashbunni avatar Jun 08 '23 16:06 bashbunni

oookay I improved the tests and added a formatting func for the databases which I needed for the tests and hopefully makes formatting dbs more reusable. It adds an extra loop for our getDbs function though which is not ideal because I want the formatting func to take a []string as arg

bashbunni avatar Jun 08 '23 18:06 bashbunni

Will update the crypto package (charm is the direct dep) in another PR to fix the CI errors

bashbunni avatar Mar 05 '24 18:03 bashbunni