heapwolf / ldb

A C++ REPL / CLI for LevelDB
MIT License
201 stars 23 forks source link

refactor, clean up and break out cli options into function #25

Closed ralphtheninja closed 10 years ago

ralphtheninja commented 10 years ago

Sorry about the diff. It's hard to see what happened because I got rid of indentation and at the same time reordered functions so the order in .h and .cc match. Probably easier if you just check ldb.h and ldb.cc manually.

Main goal is to try and keep the main() function super clean and start breaking out into functions. The functions can more easily be extracted into separate files later on. So should be easier to do https://github.com/hij1nx/ldb/issues/4

ralphtheninja commented 10 years ago

I have another refactor coming for the linenoise stuff. It will be in a separate repl-function. I'm thinking we probably want to have support for piping data to ldb via stdin, kind of like the batch functionality in levelup. And in that case we want to separate repl-behavior with no repl at all, just streaming updates straight into the db.

Hehe we could probably even convert it into being a backend for levelup :)

heapwolf commented 10 years ago

A few things about this commit...

  1. I've already broken out the functions into a separate file, but havn't pushed so that will conflict with this merge. I'll push that and then you can rebase and add these changes?
  2. I changed ./test db already.
  3. Piping is a good idea but how would it work? Line delimited? If we go that right your next point is important, there needs to be a way to determine if the repl should be started when ldb(1) is executed.
ralphtheninja commented 10 years ago

Sure, no prob. Push your stuff and I'll apply my stuff on top of yours.

ralphtheninja commented 10 years ago

And not sure about how the piping would work. Playing with it at the moment.