stiang / recli

RethinkDB command-line query tool and REPL
65 stars 15 forks source link

Document auth option and expose in CLI #7

Open ravi opened 9 years ago

ravi commented 9 years ago

Currently, the authKey can be specified in the YAML file but this is not documented anywhere and it is not exposed in the CLI. Both would be useful to users. I can submit a PR if there is agreement these would be useful.

stiang commented 9 years ago

Absolutely, would be great! Can you submit a PR?

ravi commented 9 years ago

Need some help to make sure I am not misreading this code in lib/misc.js:

    // Override merged result with command-line options
    for (var opt in opts) {
      if (rawOpts.hasOwnProperty(opt) && rawOpts[opt] !== opts[opt]) {
        opts[opt] = rawOpts[opt];
      }
    }

It seems to me that, with the above, we will overwrite merged results with command-line options only if each specified command-line option has a default or a global or user setting value. In the case of the authKey, a default does not make sense and the above logic becomes problematic, if my understanding is right. Hopefully I am missing something? (it's easy to work around the above of course, but I'd prefer to understand this first).

ravi commented 9 years ago

Any thoughts?

stiang commented 9 years ago

Hi,

Sorry about the late reply! Looks like you’re right, that won’t work. Feel free to rewrite the logic.