commit | 896381730a93f89380c21719cbc7ecfd3e9620a6 | [log] [tgz] |
---|---|---|
author | Todd Wang <toddw@google.com> | Sun May 10 21:09:44 2015 -0700 |
committer | Todd Wang <toddw@google.com> | Sun May 10 21:09:49 2015 -0700 |
tree | ebcf19ab537d1fa4aadbac5c51d42be2a22afafe | |
parent | 4632bce35e3854aef5da912c6cefa9768f03937c [diff] |
lib: Convert all cmdline users to cmdline2. This also includes changes in cmdline2 to allow commands with both Children and Runner set, as long as the runner doesn't take any args. This makes sense since the runner handles the no-arg case, while the children handle the with-args case. This was already being used by "v23 buildcop" and "deviced", and it seemed better to allow this behavior. Also fixed a bug in the cmdline2 package where the "at least one of Children and Runner" check wasn't returning an error, if the bad Command wasn't the root. Added tests for this case. Finally, but also important, changed how global flags are handled. Previously I was hoping we could simply change "v.io/x/ref/lib/flags" to check flag.Parsed and avoid double-parsing the flags. But the previous strategy always merged flags into a new FlagSet, and then overwrote flag.CommandLine with that value. Our usage of ref/lib/flags stashes the flag.CommandLine pointer away in an init function, which breaks that strategy. In addition, ref/lib/flags has some weird logic to set certain flags to their "default values". Presumably this was a hack to deal with double-parsing the flags for flags that are specified multiple times on the command line, and append their values. This makes it questionable whether we can really depend on not double-parsing flags. I'll look into changing our flags so that they don't depend on the multi-specification-append behavior, since that's just weird. But I'll do that separately. The actual conversions of all programs is mechanical. MultiPart: 2/3 Change-Id: I3f972421ab0dd2e684a62d68af4bb09b0b6ec5fa
This repository contains general purpose libraries used by the Vanadium project.