commit | 338f90cfddb6a0e31abf9ba3ee152005685ea4e2 | [log] [tgz] |
---|---|---|
author | Todd Wang <toddw@google.com> | Thu May 07 19:42:46 2015 -0700 |
committer | Todd Wang <toddw@google.com> | Thu May 07 19:42:54 2015 -0700 |
tree | d8673b9dc7627a7e02b49ffd895928c2544fb8b3 | |
parent | fe9b3e9447c5f3d1a9c337d9ebc3bb2e85de8fb2 [diff] |
ref: Add x/lib/cmdline2 and x/ref/lib/v23cmd. The cmdline2 package is very similar to the existing cmdline package. The main differences: * Uses Runner interface, rather than Run func. * Exposes Parse and ParseAndRun, rather than Init/Execute * Passes *Env to runners, rather than *Command. The purpose of these changes is to make it possible to get the ordering of initialization right in our command line tools that rely on v23.Init. In particular, the previous Init/Execute API was bad, since Execute perfomed both arg parsing and command running. That made it hard to inject special-purpose code, e.g. for intializing the v23 context in tests. The v23cmd package is a very small utility package that builds on top of cmdline2 to make it really easy to add commands that need a v23 context to be initialized. The combination of these two packages lets us get rid of the global gctx variable used in many of our cmdline tools. I've updated most tools that used gctx, to make sure the new mechanism is really good enough for our needs. I'll make another sweep in separate CLs to convert all other tools over to cmdline2, and then have mechanical CLs to replace cmdline with cmdline2. Addresses some of vanadium/issues#407 Change-Id: Ie32bc4c45453442dcccd9d8d68bb4713dbdeac89
This repository contains a reference implementation of the Vanadium APIs.
Unlike the APIs in https://github.com/vanadium/go.v23, which promises to provide backward compatibility this repository makes no such promises.