ref: Replace v.io/x/lib/cmdline with v.io/x/lib/cmdline2
Nobody is using the old cmdline package anymore, so this sequence
of CLs removes the old cmdline and renames cmdline2 to cmdline.
An empty cmdline2/.api file is leftover, necessary for the api
checking tool. That will be removed in a subsequent CL.
MultiPart: 3/4
Change-Id: I63a3d31858762a213d789e18e199bc386c95cc22
diff --git a/cmd/gclogs/gclogs.go b/cmd/gclogs/gclogs.go
index 4ba69d5..144752e 100644
--- a/cmd/gclogs/gclogs.go
+++ b/cmd/gclogs/gclogs.go
@@ -16,7 +16,7 @@
"regexp"
"time"
- "v.io/x/lib/cmdline2"
+ "v.io/x/lib/cmdline"
)
var (
@@ -25,8 +25,8 @@
flagVerbose bool
flagDryrun bool
- cmdGCLogs = &cmdline2.Command{
- Runner: cmdline2.RunnerFunc(garbageCollectLogs),
+ cmdGCLogs = &cmdline.Command{
+ Runner: cmdline.RunnerFunc(garbageCollectLogs),
Name: "gclogs",
Short: "safely deletes old log files",
Long: `
@@ -52,10 +52,10 @@
}
func main() {
- cmdline2.Main(cmdGCLogs)
+ cmdline.Main(cmdGCLogs)
}
-func garbageCollectLogs(env *cmdline2.Env, args []string) error {
+func garbageCollectLogs(env *cmdline.Env, args []string) error {
if len(args) == 0 {
env.UsageErrorf("gclogs requires at least one argument")
}
@@ -77,7 +77,7 @@
return lastErr
}
-func processDirectory(env *cmdline2.Env, logdir string, timeCutoff time.Time, programRE *regexp.Regexp, username string) error {
+func processDirectory(env *cmdline.Env, logdir string, timeCutoff time.Time, programRE *regexp.Regexp, username string) error {
fmt.Fprintf(env.Stdout, "Processing: %q\n", logdir)
f, err := os.Open(logdir)
diff --git a/cmd/gclogs/gclogs_test.go b/cmd/gclogs/gclogs_test.go
index da7b0ea..c8923e4 100644
--- a/cmd/gclogs/gclogs_test.go
+++ b/cmd/gclogs/gclogs_test.go
@@ -16,7 +16,7 @@
"testing"
"time"
- "v.io/x/lib/cmdline2"
+ "v.io/x/lib/cmdline"
)
func setup(t *testing.T, workdir, username string) (tmpdir string) {
@@ -161,8 +161,8 @@
verbose := fmt.Sprintf("--verbose=%v", tc.verbose)
dryrun := fmt.Sprintf("--n=%v", tc.dryrun)
var stdout, stderr bytes.Buffer
- env := &cmdline2.Env{Stdout: &stdout, Stderr: &stderr}
- if err := cmdline2.ParseAndRun(cmdGCLogs, env, []string{cutoff, verbose, dryrun, testdir}); err != nil {
+ env := &cmdline.Env{Stdout: &stdout, Stderr: &stderr}
+ if err := cmdline.ParseAndRun(cmdGCLogs, env, []string{cutoff, verbose, dryrun, testdir}); err != nil {
t.Fatalf("%v: %v", stderr.String(), err)
}
gotsl := strings.Split(stdout.String(), "\n")
diff --git a/cmd/mounttable/impl.go b/cmd/mounttable/impl.go
index 3acb02b..80ba494 100644
--- a/cmd/mounttable/impl.go
+++ b/cmd/mounttable/impl.go
@@ -19,18 +19,18 @@
"v.io/v23/options"
"v.io/v23/rpc"
"v.io/v23/security"
- "v.io/x/lib/cmdline2"
+ "v.io/x/lib/cmdline"
"v.io/x/lib/vlog"
"v.io/x/ref/lib/v23cmd"
_ "v.io/x/ref/runtime/factories/generic"
)
func main() {
- cmdline2.HideGlobalFlagsExcept(regexp.MustCompile(`^v23\.namespace\.root$`))
- cmdline2.Main(cmdRoot)
+ cmdline.HideGlobalFlagsExcept(regexp.MustCompile(`^v23\.namespace\.root$`))
+ cmdline.Main(cmdRoot)
}
-var cmdGlob = &cmdline2.Command{
+var cmdGlob = &cmdline.Command{
Runner: v23cmd.RunnerFunc(runGlob),
Name: "glob",
Short: "returns all matching entries in the mount table",
@@ -43,7 +43,7 @@
`,
}
-func runGlob(ctx *context.T, env *cmdline2.Env, args []string) error {
+func runGlob(ctx *context.T, env *cmdline.Env, args []string) error {
ctx, cancel := context.WithTimeout(ctx, time.Minute)
defer cancel()
@@ -84,7 +84,7 @@
return nil
}
-var cmdMount = &cmdline2.Command{
+var cmdMount = &cmdline.Command{
Runner: v23cmd.RunnerFunc(runMount),
Name: "mount",
Short: "Mounts a server <name> onto a mount table",
@@ -103,7 +103,7 @@
`,
}
-func runMount(ctx *context.T, env *cmdline2.Env, args []string) error {
+func runMount(ctx *context.T, env *cmdline.Env, args []string) error {
got := len(args)
if got < 2 || got > 4 {
return env.UsageErrorf("mount: incorrect number of arguments, expected 2, 3, or 4, got %d", got)
@@ -140,7 +140,7 @@
return nil
}
-var cmdUnmount = &cmdline2.Command{
+var cmdUnmount = &cmdline.Command{
Runner: v23cmd.RunnerFunc(runUnmount),
Name: "unmount",
Short: "removes server <name> from the mount table",
@@ -152,7 +152,7 @@
`,
}
-func runUnmount(ctx *context.T, env *cmdline2.Env, args []string) error {
+func runUnmount(ctx *context.T, env *cmdline.Env, args []string) error {
if expected, got := 2, len(args); expected != got {
return env.UsageErrorf("unmount: incorrect number of arguments, expected %d, got %d", expected, got)
}
@@ -166,7 +166,7 @@
return nil
}
-var cmdResolveStep = &cmdline2.Command{
+var cmdResolveStep = &cmdline.Command{
Runner: v23cmd.RunnerFunc(runResolveStep),
Name: "resolvestep",
Short: "takes the next step in resolving a name.",
@@ -177,7 +177,7 @@
`,
}
-func runResolveStep(ctx *context.T, env *cmdline2.Env, args []string) error {
+func runResolveStep(ctx *context.T, env *cmdline.Env, args []string) error {
if expected, got := 1, len(args); expected != got {
return env.UsageErrorf("mount: incorrect number of arguments, expected %d, got %d", expected, got)
}
@@ -192,13 +192,13 @@
return nil
}
-var cmdRoot = &cmdline2.Command{
+var cmdRoot = &cmdline.Command{
Name: "mounttable",
Short: "sends commands to Vanadium mounttable services",
Long: `
Command mounttable sends commands to Vanadium mounttable services.
`,
- Children: []*cmdline2.Command{cmdGlob, cmdMount, cmdUnmount, cmdResolveStep},
+ Children: []*cmdline.Command{cmdGlob, cmdMount, cmdUnmount, cmdResolveStep},
}
func blessingPatternsFromServer(ctx *context.T, server string) ([]security.BlessingPattern, error) {
diff --git a/cmd/mounttable/impl_test.go b/cmd/mounttable/impl_test.go
index 8628208..4e50553 100644
--- a/cmd/mounttable/impl_test.go
+++ b/cmd/mounttable/impl_test.go
@@ -19,7 +19,7 @@
"v.io/v23/security/access"
"v.io/v23/services/mounttable"
vdltime "v.io/v23/vdlroot/time"
- "v.io/x/lib/cmdline2"
+ "v.io/x/lib/cmdline"
"v.io/x/lib/vlog"
"v.io/x/ref/lib/v23cmd"
_ "v.io/x/ref/runtime/factories/generic"
@@ -128,7 +128,7 @@
// Setup the command-line.
var stdout, stderr bytes.Buffer
- env := &cmdline2.Env{Stdout: &stdout, Stderr: &stderr}
+ env := &cmdline.Env{Stdout: &stdout, Stderr: &stderr}
// Test the 'glob' command.
if err := v23cmd.ParseAndRun(cmdRoot, ctx, env, []string{"glob", naming.JoinAddressName(endpoint.String(), ""), "*"}); err != nil {
diff --git a/cmd/namespace/impl.go b/cmd/namespace/impl.go
index b329b9c..3b24ae3 100644
--- a/cmd/namespace/impl.go
+++ b/cmd/namespace/impl.go
@@ -21,15 +21,15 @@
"v.io/v23/options"
"v.io/v23/security/access"
"v.io/v23/verror"
- "v.io/x/lib/cmdline2"
+ "v.io/x/lib/cmdline"
"v.io/x/lib/vlog"
"v.io/x/ref/lib/v23cmd"
_ "v.io/x/ref/runtime/factories/generic"
)
func main() {
- cmdline2.HideGlobalFlagsExcept(regexp.MustCompile(`^v23\.namespace\.root$`))
- cmdline2.Main(cmdRoot)
+ cmdline.HideGlobalFlagsExcept(regexp.MustCompile(`^v23\.namespace\.root$`))
+ cmdline.Main(cmdRoot)
}
var (
@@ -46,7 +46,7 @@
cmdDelete.Flags.BoolVar(&flagDeleteSubtree, "r", false, "Delete all children of the name in addition to the name itself.")
}
-var cmdGlob = &cmdline2.Command{
+var cmdGlob = &cmdline.Command{
Runner: v23cmd.RunnerFunc(runGlob),
Name: "glob",
Short: "Returns all matching entries from the namespace",
@@ -58,7 +58,7 @@
`,
}
-func runGlob(ctx *context.T, env *cmdline2.Env, args []string) error {
+func runGlob(ctx *context.T, env *cmdline.Env, args []string) error {
if expected, got := 1, len(args); expected != got {
return env.UsageErrorf("glob: incorrect number of arguments, expected %d, got %d", expected, got)
}
@@ -118,7 +118,7 @@
return nil
}
-var cmdMount = &cmdline2.Command{
+var cmdMount = &cmdline.Command{
Runner: v23cmd.RunnerFunc(runMount),
Name: "mount",
Short: "Adds a server to the namespace",
@@ -132,7 +132,7 @@
`,
}
-func runMount(ctx *context.T, env *cmdline2.Env, args []string) error {
+func runMount(ctx *context.T, env *cmdline.Env, args []string) error {
if expected, got := 3, len(args); expected != got {
return env.UsageErrorf("mount: incorrect number of arguments, expected %d, got %d", expected, got)
}
@@ -157,7 +157,7 @@
return nil
}
-var cmdUnmount = &cmdline2.Command{
+var cmdUnmount = &cmdline.Command{
Runner: v23cmd.RunnerFunc(runUnmount),
Name: "unmount",
Short: "Removes a server from the namespace",
@@ -169,7 +169,7 @@
`,
}
-func runUnmount(ctx *context.T, env *cmdline2.Env, args []string) error {
+func runUnmount(ctx *context.T, env *cmdline.Env, args []string) error {
if expected, got := 2, len(args); expected != got {
return env.UsageErrorf("unmount: incorrect number of arguments, expected %d, got %d", expected, got)
}
@@ -189,7 +189,7 @@
return nil
}
-var cmdResolve = &cmdline2.Command{
+var cmdResolve = &cmdline.Command{
Runner: v23cmd.RunnerFunc(runResolve),
Name: "resolve",
Short: "Translates a object name to its object address(es)",
@@ -198,7 +198,7 @@
ArgsLong: "<name> is the name to resolve.",
}
-func runResolve(ctx *context.T, env *cmdline2.Env, args []string) error {
+func runResolve(ctx *context.T, env *cmdline.Env, args []string) error {
if expected, got := 1, len(args); expected != got {
return env.UsageErrorf("resolve: incorrect number of arguments, expected %d, got %d", expected, got)
}
@@ -224,7 +224,7 @@
return nil
}
-var cmdResolveToMT = &cmdline2.Command{
+var cmdResolveToMT = &cmdline.Command{
Runner: v23cmd.RunnerFunc(runResolveToMT),
Name: "resolvetomt",
Short: "Finds the address of the mounttable that holds an object name",
@@ -233,7 +233,7 @@
ArgsLong: "<name> is the name to resolve.",
}
-func runResolveToMT(ctx *context.T, env *cmdline2.Env, args []string) error {
+func runResolveToMT(ctx *context.T, env *cmdline.Env, args []string) error {
if expected, got := 1, len(args); expected != got {
return env.UsageErrorf("resolvetomt: incorrect number of arguments, expected %d, got %d", expected, got)
}
@@ -258,7 +258,7 @@
return nil
}
-var cmdPermissions = &cmdline2.Command{
+var cmdPermissions = &cmdline.Command{
Name: "permissions",
Short: "Manipulates permissions on an entry in the namespace",
Long: `
@@ -268,10 +268,10 @@
The permissions are provided as an JSON-encoded version of the Permissions type
defined in v.io/v23/security/access/types.vdl.
`,
- Children: []*cmdline2.Command{cmdPermissionsGet, cmdPermissionsSet},
+ Children: []*cmdline.Command{cmdPermissionsGet, cmdPermissionsSet},
}
-var cmdPermissionsSet = &cmdline2.Command{
+var cmdPermissionsSet = &cmdline.Command{
Runner: v23cmd.RunnerFunc(runPermissionsSet),
Name: "set",
Short: "Sets permissions on a mount name",
@@ -287,7 +287,7 @@
`,
}
-func runPermissionsSet(ctx *context.T, env *cmdline2.Env, args []string) error {
+func runPermissionsSet(ctx *context.T, env *cmdline.Env, args []string) error {
if expected, got := 2, len(args); expected != got {
return env.UsageErrorf("set: incorrect number of arguments, expected %d, got %d", expected, got)
}
@@ -320,7 +320,7 @@
}
}
-var cmdPermissionsGet = &cmdline2.Command{
+var cmdPermissionsGet = &cmdline.Command{
Runner: v23cmd.RunnerFunc(runPermissionsGet),
Name: "get",
Short: "Gets permissions on a mount name",
@@ -336,7 +336,7 @@
`,
}
-func runPermissionsGet(ctx *context.T, env *cmdline2.Env, args []string) error {
+func runPermissionsGet(ctx *context.T, env *cmdline.Env, args []string) error {
if expected, got := 1, len(args); expected != got {
return env.UsageErrorf("get: incorrect number of arguments, expected %d, got %d", expected, got)
}
@@ -351,7 +351,7 @@
return json.NewEncoder(env.Stdout).Encode(perms)
}
-var cmdDelete = &cmdline2.Command{
+var cmdDelete = &cmdline.Command{
Runner: v23cmd.RunnerFunc(runDelete),
Name: "delete",
Short: "Deletes a name from the namespace",
@@ -360,7 +360,7 @@
Long: "Deletes a name from the namespace.",
}
-func runDelete(ctx *context.T, env *cmdline2.Env, args []string) error {
+func runDelete(ctx *context.T, env *cmdline.Env, args []string) error {
if expected, got := 1, len(args); expected != got {
return env.UsageErrorf("delete: incorrect number of arguments, expected %d, got %d", expected, got)
}
@@ -371,7 +371,7 @@
return v23.GetNamespace(ctx).Delete(ctx, name, flagDeleteSubtree)
}
-var cmdRoot = &cmdline2.Command{
+var cmdRoot = &cmdline.Command{
Name: "namespace",
Short: "resolves and manages names in the Vanadium namespace",
Long: `
@@ -382,5 +382,5 @@
with V23_NAMESPACE, e.g. V23_NAMESPACE, V23_NAMESPACE_2, V23_NAMESPACE_GOOGLE,
etc. The command line options override the environment.
`,
- Children: []*cmdline2.Command{cmdGlob, cmdMount, cmdUnmount, cmdResolve, cmdResolveToMT, cmdPermissions, cmdDelete},
+ Children: []*cmdline.Command{cmdGlob, cmdMount, cmdUnmount, cmdResolve, cmdResolveToMT, cmdPermissions, cmdDelete},
}
diff --git a/cmd/principal/main.go b/cmd/principal/main.go
index 948338a..b14da0e 100644
--- a/cmd/principal/main.go
+++ b/cmd/principal/main.go
@@ -27,7 +27,7 @@
"v.io/v23/rpc"
"v.io/v23/security"
"v.io/v23/vom"
- "v.io/x/lib/cmdline2"
+ "v.io/x/lib/cmdline"
"v.io/x/ref/envvar"
vsecurity "v.io/x/ref/lib/security"
"v.io/x/ref/lib/v23cmd"
@@ -81,14 +81,14 @@
errNoCaveats = fmt.Errorf("no caveats provided: it is generally dangerous to bless another principal without any caveats as that gives them almost unrestricted access to the blesser's credentials. If you really want to do this, set --require-caveats=false")
- cmdDump = &cmdline2.Command{
+ cmdDump = &cmdline.Command{
Name: "dump",
Short: "Dump out information about the principal",
Long: `
Prints out information about the principal specified by the environment
that this tool is running in.
`,
- Runner: v23cmd.RunnerFunc(func(ctx *context.T, env *cmdline2.Env, args []string) error {
+ Runner: v23cmd.RunnerFunc(func(ctx *context.T, env *cmdline.Env, args []string) error {
p := v23.GetPrincipal(ctx)
if flagDumpShort {
fmt.Printf("%v\n", p.BlessingStore().Default())
@@ -103,7 +103,7 @@
}),
}
- cmdDumpBlessings = &cmdline2.Command{
+ cmdDumpBlessings = &cmdline.Command{
Name: "dumpblessings",
Short: "Dump out information about the provided blessings",
Long: `
@@ -115,7 +115,7 @@
<file> is the path to a file containing blessings typically obtained from
this tool. - is used for STDIN.
`,
- Runner: cmdline2.RunnerFunc(func(env *cmdline2.Env, args []string) error {
+ Runner: cmdline.RunnerFunc(func(env *cmdline.Env, args []string) error {
if len(args) != 1 {
return fmt.Errorf("requires exactly one argument, <file>, provided %d", len(args))
}
@@ -150,7 +150,7 @@
}),
}
- cmdBlessSelf = &cmdline2.Command{
+ cmdBlessSelf = &cmdline.Command{
Name: "blessself",
Short: "Generate a self-signed blessing",
Long: `
@@ -165,7 +165,7 @@
specified, a name will be generated based on the hostname of the
machine and the name of the user running this command.
`,
- Runner: v23cmd.RunnerFunc(func(ctx *context.T, env *cmdline2.Env, args []string) error {
+ Runner: v23cmd.RunnerFunc(func(ctx *context.T, env *cmdline.Env, args []string) error {
var name string
switch len(args) {
case 0:
@@ -189,7 +189,7 @@
}),
}
- cmdBless = &cmdline2.Command{
+ cmdBless = &cmdline.Command{
Name: "bless",
Short: "Bless another principal",
Long: `
@@ -233,7 +233,7 @@
blessing.
`,
- Runner: v23cmd.RunnerFunc(func(ctx *context.T, env *cmdline2.Env, args []string) error {
+ Runner: v23cmd.RunnerFunc(func(ctx *context.T, env *cmdline.Env, args []string) error {
if len(flagRemoteArgFile) > 0 && len(args) != 1 {
return fmt.Errorf("when --remote-arg-file is provided, only <extension> is expected, provided %d", len(args))
} else if len(flagRemoteArgFile) == 0 && len(args) != 2 {
@@ -284,7 +284,7 @@
}),
}
- cmdGetPublicKey = &cmdline2.Command{
+ cmdGetPublicKey = &cmdline.Command{
Name: "publickey",
Short: "Prints the public key of the principal.",
Long: `
@@ -299,7 +299,7 @@
for humans to read and is used in output of other commands in this program, but
is not suitable as an argument to the 'recognize' command.
`,
- Runner: v23cmd.RunnerFunc(func(ctx *context.T, env *cmdline2.Env, args []string) error {
+ Runner: v23cmd.RunnerFunc(func(ctx *context.T, env *cmdline.Env, args []string) error {
key := v23.GetPrincipal(ctx).PublicKey()
if flagGetPublicKeyPretty {
fmt.Println(key)
@@ -314,7 +314,7 @@
}),
}
- cmdGetTrustedRoots = &cmdline2.Command{
+ cmdGetTrustedRoots = &cmdline.Command{
Name: "recognizedroots",
Short: "Return recognized blessings, and their associated public key.",
Long: `
@@ -323,13 +323,13 @@
appear on this list. If the principal is operating as a server, clients must
present blessings derived from this list.
`,
- Runner: v23cmd.RunnerFunc(func(ctx *context.T, env *cmdline2.Env, args []string) error {
+ Runner: v23cmd.RunnerFunc(func(ctx *context.T, env *cmdline.Env, args []string) error {
fmt.Printf(v23.GetPrincipal(ctx).Roots().DebugString())
return nil
}),
}
- cmdGetPeerMap = &cmdline2.Command{
+ cmdGetPeerMap = &cmdline.Command{
Name: "peermap",
Short: "Shows the map from peer pattern to which blessing name to present.",
Long: `
@@ -338,13 +338,13 @@
If the principal operates as a client, it presents the map value associated with
the peer it contacts.
`,
- Runner: v23cmd.RunnerFunc(func(ctx *context.T, env *cmdline2.Env, args []string) error {
+ Runner: v23cmd.RunnerFunc(func(ctx *context.T, env *cmdline.Env, args []string) error {
fmt.Printf(v23.GetPrincipal(ctx).BlessingStore().DebugString())
return nil
}),
}
- cmdGetForPeer = &cmdline2.Command{
+ cmdGetForPeer = &cmdline.Command{
Name: "forpeer",
Short: "Return blessings marked for the provided peer",
Long: `
@@ -365,12 +365,12 @@
store.forpeer returns the blessings that are marked for all peers (i.e.,
blessings set on the store with the "..." pattern).
`,
- Runner: v23cmd.RunnerFunc(func(ctx *context.T, env *cmdline2.Env, args []string) error {
+ Runner: v23cmd.RunnerFunc(func(ctx *context.T, env *cmdline.Env, args []string) error {
return printBlessingsInfo(v23.GetPrincipal(ctx).BlessingStore().ForPeer(args...))
}),
}
- cmdGetDefault = &cmdline2.Command{
+ cmdGetDefault = &cmdline.Command{
Name: "default",
Short: "Return blessings marked as default",
Long: `
@@ -382,12 +382,12 @@
Providing --caveats <chain_name> will print the caveats on the certificate chain
with chain_name.
`,
- Runner: v23cmd.RunnerFunc(func(ctx *context.T, env *cmdline2.Env, args []string) error {
+ Runner: v23cmd.RunnerFunc(func(ctx *context.T, env *cmdline.Env, args []string) error {
return printBlessingsInfo(v23.GetPrincipal(ctx).BlessingStore().Default())
}),
}
- cmdSetForPeer = &cmdline2.Command{
+ cmdSetForPeer = &cmdline.Command{
Name: "forpeer",
Short: "Set provided blessings for peer",
Long: `
@@ -412,7 +412,7 @@
<pattern> is the BlessingPattern used to identify peers with whom this
blessing can be shared with.
`,
- Runner: v23cmd.RunnerFunc(func(ctx *context.T, env *cmdline2.Env, args []string) error {
+ Runner: v23cmd.RunnerFunc(func(ctx *context.T, env *cmdline.Env, args []string) error {
if len(args) != 2 {
return fmt.Errorf("requires exactly two arguments <file>, <pattern>, provided %d", len(args))
}
@@ -435,7 +435,7 @@
}),
}
- cmdRecognize = &cmdline2.Command{
+ cmdRecognize = &cmdline.Command{
Name: "recognize",
Short: "Add to the set of identity providers recognized by this principal",
Long: `
@@ -463,7 +463,7 @@
<blessing pattern> is the blessing pattern for which <key> should be recognized.
`,
- Runner: v23cmd.RunnerFunc(func(ctx *context.T, env *cmdline2.Env, args []string) error {
+ Runner: v23cmd.RunnerFunc(func(ctx *context.T, env *cmdline.Env, args []string) error {
if len(args) != 1 && len(args) != 2 {
return fmt.Errorf("requires either one argument <file>, or two arguments <key> <blessing pattern>, provided %d", len(args))
}
@@ -491,7 +491,7 @@
}),
}
- cmdSetDefault = &cmdline2.Command{
+ cmdSetDefault = &cmdline.Command{
Name: "default",
Short: "Set provided blessings as default",
Long: `
@@ -506,7 +506,7 @@
<file> is the path to a file containing a blessing typically obtained from
this tool. - is used for STDIN.
`,
- Runner: v23cmd.RunnerFunc(func(ctx *context.T, env *cmdline2.Env, args []string) error {
+ Runner: v23cmd.RunnerFunc(func(ctx *context.T, env *cmdline.Env, args []string) error {
if len(args) != 1 {
return fmt.Errorf("requires exactly one argument, <file>, provided %d", len(args))
}
@@ -528,7 +528,7 @@
}),
}
- cmdCreate = &cmdline2.Command{
+ cmdCreate = &cmdline.Command{
Name: "create",
Short: "Create a new principal and persist it into a directory",
Long: `
@@ -546,7 +546,7 @@
<blessing> is the self-blessed blessing that the principal will be setup to use by default.
`,
- Runner: cmdline2.RunnerFunc(func(env *cmdline2.Env, args []string) error {
+ Runner: cmdline.RunnerFunc(func(env *cmdline.Env, args []string) error {
if len(args) != 2 {
return fmt.Errorf("requires exactly two arguments: <directory> and <blessing>, provided %d", len(args))
}
@@ -571,7 +571,7 @@
}),
}
- cmdFork = &cmdline2.Command{
+ cmdFork = &cmdline.Command{
Name: "fork",
Short: "Fork a new principal from the principal that this tool is running as and persist it into a directory",
Long: `
@@ -593,7 +593,7 @@
<extension> is the extension under which the forked principal is blessed.
`,
- Runner: v23cmd.RunnerFunc(func(ctx *context.T, env *cmdline2.Env, args []string) error {
+ Runner: v23cmd.RunnerFunc(func(ctx *context.T, env *cmdline.Env, args []string) error {
if len(args) != 2 {
return fmt.Errorf("requires exactly two arguments: <directory> and <extension>, provided %d", len(args))
}
@@ -640,7 +640,7 @@
}),
}
- cmdSeekBlessings = &cmdline2.Command{
+ cmdSeekBlessings = &cmdline.Command{
Name: "seekblessings",
Short: "Seek blessings from a web-based Vanadium blessing service",
Long: `
@@ -655,7 +655,7 @@
set to true, and are also set for sharing with all peers, unless a more
specific peer pattern is provided using the --for-peer flag.
`,
- Runner: v23cmd.RunnerFunc(func(ctx *context.T, env *cmdline2.Env, args []string) error {
+ Runner: v23cmd.RunnerFunc(func(ctx *context.T, env *cmdline.Env, args []string) error {
p := v23.GetPrincipal(ctx)
blessedChan := make(chan string)
@@ -693,7 +693,7 @@
}),
}
- cmdRecvBlessings = &cmdline2.Command{
+ cmdRecvBlessings = &cmdline.Command{
Name: "recvblessings",
Short: "Receive blessings sent by another principal and use them as the default",
Long: `
@@ -733,7 +733,7 @@
principal bless --remote-arg-file FILE EXTENSION
`,
- Runner: v23cmd.RunnerFunc(func(ctx *context.T, env *cmdline2.Env, args []string) error {
+ Runner: v23cmd.RunnerFunc(func(ctx *context.T, env *cmdline.Env, args []string) error {
if len(args) != 0 {
return fmt.Errorf("command accepts no arguments")
}
@@ -853,7 +853,7 @@
}
func main() {
- cmdline2.HideGlobalFlagsExcept()
+ cmdline.HideGlobalFlagsExcept()
cmdBlessSelf.Flags.Var(&flagBlessSelfCaveats, "caveat", flagBlessSelfCaveats.usage())
cmdBlessSelf.Flags.DurationVar(&flagBlessSelfFor, "for", 0, "Duration of blessing validity (zero implies no expiration)")
@@ -903,7 +903,7 @@
cmdGetPublicKey.Flags.BoolVar(&flagGetPublicKeyPretty, "pretty", false, "If true, print the key out in a more human-readable but lossy representation.")
- cmdSet := &cmdline2.Command{
+ cmdSet := &cmdline.Command{
Name: "set",
Short: "Mutate the principal's blessings.",
Long: `
@@ -912,10 +912,10 @@
All input blessings are expected to be serialized using base64-VOM-encoding.
See 'principal get'.
`,
- Children: []*cmdline2.Command{cmdSetDefault, cmdSetForPeer},
+ Children: []*cmdline.Command{cmdSetDefault, cmdSetForPeer},
}
- cmdGet := &cmdline2.Command{
+ cmdGet := &cmdline.Command{
Name: "get",
Short: "Read the principal's blessings.",
Long: `
@@ -923,10 +923,10 @@
All blessings are printed to stdout using base64-VOM-encoding.
`,
- Children: []*cmdline2.Command{cmdGetDefault, cmdGetForPeer, cmdGetPublicKey, cmdGetTrustedRoots, cmdGetPeerMap},
+ Children: []*cmdline.Command{cmdGetDefault, cmdGetForPeer, cmdGetPublicKey, cmdGetTrustedRoots, cmdGetPeerMap},
}
- root := &cmdline2.Command{
+ root := &cmdline.Command{
Name: "principal",
Short: "creates and manages Vanadium principals and blessings",
Long: `
@@ -934,9 +934,9 @@
All objects are printed using base64-VOM-encoding.
`,
- Children: []*cmdline2.Command{cmdCreate, cmdFork, cmdSeekBlessings, cmdRecvBlessings, cmdDump, cmdDumpBlessings, cmdBlessSelf, cmdBless, cmdSet, cmdGet, cmdRecognize},
+ Children: []*cmdline.Command{cmdCreate, cmdFork, cmdSeekBlessings, cmdRecvBlessings, cmdDump, cmdDumpBlessings, cmdBlessSelf, cmdBless, cmdSet, cmdGet, cmdRecognize},
}
- cmdline2.Main(root)
+ cmdline.Main(root)
}
func decodeBlessings(fname string) (security.Blessings, error) {
diff --git a/cmd/uniqueid/main.go b/cmd/uniqueid/main.go
index 3d27018..bd98c32 100644
--- a/cmd/uniqueid/main.go
+++ b/cmd/uniqueid/main.go
@@ -14,26 +14,26 @@
"regexp"
"v.io/v23/uniqueid"
- "v.io/x/lib/cmdline2"
+ "v.io/x/lib/cmdline"
)
func main() {
- cmdline2.Main(cmdUniqueId)
+ cmdline.Main(cmdUniqueId)
}
-var cmdUniqueId = &cmdline2.Command{
+var cmdUniqueId = &cmdline.Command{
Name: "uniqueid",
Short: "generates unique identifiers",
Long: `
Command uniqueid generates unique identifiers.
It also has an option of automatically substituting unique ids with placeholders in files.
`,
- Children: []*cmdline2.Command{cmdGenerate, cmdInject},
- Topics: []cmdline2.Topic{},
+ Children: []*cmdline.Command{cmdGenerate, cmdInject},
+ Topics: []cmdline.Topic{},
}
-var cmdGenerate = &cmdline2.Command{
- Runner: cmdline2.RunnerFunc(runGenerate),
+var cmdGenerate = &cmdline.Command{
+ Runner: cmdline.RunnerFunc(runGenerate),
Name: "generate",
Short: "Generates UniqueIds",
Long: `
@@ -43,8 +43,8 @@
ArgsLong: "",
}
-var cmdInject = &cmdline2.Command{
- Runner: cmdline2.RunnerFunc(runInject),
+var cmdInject = &cmdline.Command{
+ Runner: cmdline.RunnerFunc(runInject),
Name: "inject",
Short: "Injects UniqueIds into existing files",
Long: `
@@ -56,7 +56,7 @@
}
// runGenerate implements the generate command which outputs generated ids to stdout.
-func runGenerate(env *cmdline2.Env, args []string) error {
+func runGenerate(env *cmdline.Env, args []string) error {
if len(args) > 0 {
return env.UsageErrorf("expected 0 args, got %d", len(args))
}
@@ -69,7 +69,7 @@
}
// runInject implements the inject command which replaces $UNIQUEID$ strings with generated ids.
-func runInject(env *cmdline2.Env, args []string) error {
+func runInject(env *cmdline.Env, args []string) error {
if len(args) == 0 {
return env.UsageErrorf("expected at least one file arg, got 0")
}
diff --git a/cmd/vdl/main.go b/cmd/vdl/main.go
index 4c8c557..50c4c22 100644
--- a/cmd/vdl/main.go
+++ b/cmd/vdl/main.go
@@ -17,7 +17,7 @@
"strings"
"v.io/v23/vdlroot/vdltool"
- "v.io/x/lib/cmdline2"
+ "v.io/x/lib/cmdline"
"v.io/x/lib/textutil"
"v.io/x/ref/lib/vdl/build"
"v.io/x/ref/lib/vdl/codegen/golang"
@@ -32,7 +32,7 @@
}
func main() {
- cmdline2.Main(cmdVDL)
+ cmdline.Main(cmdVDL)
}
func checkErrors(errs *vdlutil.Errors) error {
@@ -45,8 +45,8 @@
// runHelper returns a function that generates a sorted list of transitive
// targets, and calls the supplied run function.
-func runHelper(run func(targets []*build.Package, env *compile.Env)) cmdline2.Runner {
- return cmdline2.RunnerFunc(func(_ *cmdline2.Env, args []string) error {
+func runHelper(run func(targets []*build.Package, env *compile.Env)) cmdline.Runner {
+ return cmdline.RunnerFunc(func(_ *cmdline.Env, args []string) error {
if flagVerbose {
vdlutil.SetVerbose()
}
@@ -72,7 +72,7 @@
})
}
-var topicPackages = cmdline2.Topic{
+var topicPackages = cmdline.Topic{
Name: "packages",
Short: "Description of package lists",
Long: `
@@ -105,7 +105,7 @@
`,
}
-var topicVdlPath = cmdline2.Topic{
+var topicVdlPath = cmdline.Topic{
Name: "vdlpath",
Short: "Description of VDLPATH environment variable",
Long: `
@@ -135,7 +135,7 @@
`,
}
-var topicVdlRoot = cmdline2.Topic{
+var topicVdlRoot = cmdline.Topic{
Name: "vdlroot",
Short: "Description of VDLROOT environment variable",
Long: `
@@ -150,7 +150,7 @@
`,
}
-var topicVdlConfig = cmdline2.Topic{
+var topicVdlConfig = cmdline.Topic{
Name: "vdl.config",
Short: "Description of vdl.config files",
Long: `
@@ -170,7 +170,7 @@
For more information, run "vdl help packages".
`
-var cmdCompile = &cmdline2.Command{
+var cmdCompile = &cmdline.Command{
Runner: runHelper(runCompile),
Name: "compile",
Short: "Compile packages and dependencies, but don't generate code",
@@ -182,7 +182,7 @@
ArgsLong: pkgArgLong,
}
-var cmdGenerate = &cmdline2.Command{
+var cmdGenerate = &cmdline.Command{
Runner: runHelper(runGenerate),
Name: "generate",
Short: "Compile packages and dependencies, and generate code",
@@ -194,7 +194,7 @@
ArgsLong: pkgArgLong,
}
-var cmdAudit = &cmdline2.Command{
+var cmdAudit = &cmdline.Command{
Runner: runHelper(runAudit),
Name: "audit",
Short: "Check if any packages are stale and need generation",
@@ -207,7 +207,7 @@
ArgsLong: pkgArgLong,
}
-var cmdList = &cmdline2.Command{
+var cmdList = &cmdline.Command{
Runner: runHelper(runList),
Name: "list",
Short: "List package and dependency info in transitive order",
@@ -243,7 +243,7 @@
}
func (gls *genLangs) Set(value string) error {
- // If the flag is repeated on the cmdline2 it is overridden. Duplicates within
+ // If the flag is repeated on the cmdline it is overridden. Duplicates within
// the comma separated list are ignored, and retain their original ordering.
*gls = genLangs{}
seen := make(map[vdltool.GenLanguage]bool)
@@ -354,15 +354,15 @@
)
// Root returns the root command for the VDL tool.
-var cmdVDL = &cmdline2.Command{
+var cmdVDL = &cmdline.Command{
Name: "vdl",
Short: "manages Vanadium Definition Language source code",
Long: `
Command vdl manages Vanadium Definition Language source code. It's similar to
the go tool used for managing Go source code.
`,
- Children: []*cmdline2.Command{cmdGenerate, cmdCompile, cmdAudit, cmdList},
- Topics: []cmdline2.Topic{topicPackages, topicVdlPath, topicVdlRoot, topicVdlConfig},
+ Children: []*cmdline.Command{cmdGenerate, cmdCompile, cmdAudit, cmdList},
+ Topics: []cmdline.Topic{topicPackages, topicVdlPath, topicVdlRoot, topicVdlConfig},
}
func init() {
diff --git a/cmd/vdl/vdl_test.go b/cmd/vdl/vdl_test.go
index 12848ab..0607fab 100644
--- a/cmd/vdl/vdl_test.go
+++ b/cmd/vdl/vdl_test.go
@@ -13,7 +13,7 @@
"strings"
"testing"
- "v.io/x/lib/cmdline2"
+ "v.io/x/lib/cmdline"
)
const (
@@ -33,8 +33,8 @@
defer os.RemoveAll(outDir)
// TODO(toddw): test the generated java and javascript files too.
outOpt := fmt.Sprintf("--go-out-dir=%s", outDir)
- env := cmdline2.NewEnv()
- if err := cmdline2.ParseAndRun(cmdVDL, env, []string{"generate", "--lang=go", outOpt, testDir}); err != nil {
+ env := cmdline.NewEnv()
+ if err := cmdline.ParseAndRun(cmdVDL, env, []string{"generate", "--lang=go", outOpt, testDir}); err != nil {
t.Fatalf("Execute() failed: %v", err)
}
// Check that each *.vdl.go file in the testDir matches the generated output.
diff --git a/cmd/vom/vom.go b/cmd/vom/vom.go
index f387762..24b1d7a 100644
--- a/cmd/vom/vom.go
+++ b/cmd/vom/vom.go
@@ -19,24 +19,24 @@
"v.io/v23/vdl"
"v.io/v23/vom"
- "v.io/x/lib/cmdline2"
+ "v.io/x/lib/cmdline"
)
func main() {
- cmdline2.Main(cmdVom)
+ cmdline.Main(cmdVom)
}
-var cmdVom = &cmdline2.Command{
+var cmdVom = &cmdline.Command{
Name: "vom",
Short: "helps debug the Vanadium Object Marshaling wire protocol",
Long: `
Command vom helps debug the Vanadium Object Marshaling wire protocol.
`,
- Children: []*cmdline2.Command{cmdDecode, cmdDump},
+ Children: []*cmdline.Command{cmdDecode, cmdDump},
}
-var cmdDecode = &cmdline2.Command{
- Runner: cmdline2.RunnerFunc(runDecode),
+var cmdDecode = &cmdline.Command{
+ Runner: cmdline.RunnerFunc(runDecode),
Name: "decode",
Short: "Decode data encoded in the vom format",
Long: `
@@ -52,8 +52,8 @@
ArgsLong: "[data] is the data to decode; if not specified, reads from stdin",
}
-var cmdDump = &cmdline2.Command{
- Runner: cmdline2.RunnerFunc(runDump),
+var cmdDump = &cmdline.Command{
+ Runner: cmdline.RunnerFunc(runDump),
Name: "dump",
Short: "Dump data encoded in the vom format into formatted output",
Long: `
@@ -91,7 +91,7 @@
"Data representation, one of "+fmt.Sprint(dataRepAll))
}
-func runDecode(env *cmdline2.Env, args []string) error {
+func runDecode(env *cmdline.Env, args []string) error {
// Convert all inputs into a reader over binary bytes.
var data string
switch {
@@ -125,7 +125,7 @@
return nil
}
-func runDump(env *cmdline2.Env, args []string) error {
+func runDump(env *cmdline.Env, args []string) error {
// Handle non-streaming cases.
switch {
case len(args) > 1:
diff --git a/cmd/vomtestgen/generate.go b/cmd/vomtestgen/generate.go
index a6bf53e..19e4ac7 100644
--- a/cmd/vomtestgen/generate.go
+++ b/cmd/vomtestgen/generate.go
@@ -18,7 +18,7 @@
"v.io/v23/vdl"
"v.io/v23/vom"
- "v.io/x/lib/cmdline2"
+ "v.io/x/lib/cmdline"
"v.io/x/ref/lib/vdl/build"
"v.io/x/ref/lib/vdl/codegen"
"v.io/x/ref/lib/vdl/codegen/vdlgen"
@@ -32,8 +32,8 @@
vomdataConfig = "vomdata.vdl.config"
)
-var cmdGenerate = &cmdline2.Command{
- Runner: cmdline2.RunnerFunc(runGenerate),
+var cmdGenerate = &cmdline.Command{
+ Runner: cmdline.RunnerFunc(runGenerate),
Name: "vomtestgen",
Short: "generates test data for the vom wire protocol implementation",
Long: `
@@ -69,10 +69,10 @@
}
func main() {
- cmdline2.Main(cmdGenerate)
+ cmdline.Main(cmdGenerate)
}
-func runGenerate(env *cmdline2.Env, args []string) error {
+func runGenerate(env *cmdline.Env, args []string) error {
debug := new(bytes.Buffer)
defer dumpDebug(env.Stderr, debug)
compileEnv := compile.NewEnv(optGenMaxErrors)
diff --git a/cmd/vrpc/vrpc.go b/cmd/vrpc/vrpc.go
index b3c654e..e0f35e0 100644
--- a/cmd/vrpc/vrpc.go
+++ b/cmd/vrpc/vrpc.go
@@ -22,7 +22,7 @@
"v.io/v23/rpc/reserved"
"v.io/v23/vdl"
"v.io/v23/vdlroot/signature"
- "v.io/x/lib/cmdline2"
+ "v.io/x/lib/cmdline"
"v.io/x/ref/lib/v23cmd"
"v.io/x/ref/lib/vdl/build"
"v.io/x/ref/lib/vdl/codegen/vdlgen"
@@ -37,8 +37,8 @@
)
func main() {
- cmdline2.HideGlobalFlagsExcept(regexp.MustCompile(`^v23\.namespace\.root$`))
- cmdline2.Main(cmdVRPC)
+ cmdline.HideGlobalFlagsExcept(regexp.MustCompile(`^v23\.namespace\.root$`))
+ cmdline.Main(cmdVRPC)
}
func init() {
@@ -53,7 +53,7 @@
cmdSignature.Flags.BoolVar(&flagShowReserved, "show-reserved", false, "if true, also show the signatures of reserved methods")
}
-var cmdVRPC = &cmdline2.Command{
+var cmdVRPC = &cmdline.Command{
Name: "vrpc",
Short: "sends and receives Vanadium remote procedure calls",
Long: `
@@ -63,7 +63,7 @@
// TODO(toddw): Add cmdServe, which will take an interface as input, and set
// up a server capable of handling the given methods. When a request is
// received, it'll allow the user to respond via stdin.
- Children: []*cmdline2.Command{cmdSignature, cmdCall, cmdIdentify},
+ Children: []*cmdline.Command{cmdSignature, cmdCall, cmdIdentify},
}
const serverDesc = `
@@ -71,7 +71,7 @@
the server, or an object name that will be resolved to an end-point.
`
-var cmdSignature = &cmdline2.Command{
+var cmdSignature = &cmdline.Command{
Runner: v23cmd.RunnerFunc(runSignature),
Name: "signature",
Short: "Describe the interfaces of a Vanadium server",
@@ -88,7 +88,7 @@
`,
}
-var cmdCall = &cmdline2.Command{
+var cmdCall = &cmdline.Command{
Runner: v23cmd.RunnerFunc(runCall),
Name: "call",
Short: "Call a method of a Vanadium server",
@@ -119,7 +119,7 @@
`,
}
-var cmdIdentify = &cmdline2.Command{
+var cmdIdentify = &cmdline.Command{
Runner: v23cmd.RunnerFunc(runIdentify),
Name: "identify",
Short: "Reveal blessings presented by a Vanadium server",
@@ -132,7 +132,7 @@
ArgsLong: serverDesc,
}
-func runSignature(ctx *context.T, env *cmdline2.Env, args []string) error {
+func runSignature(ctx *context.T, env *cmdline.Env, args []string) error {
// Error-check args.
var server, method string
switch len(args) {
@@ -180,7 +180,7 @@
return nil
}
-func runCall(ctx *context.T, env *cmdline2.Env, args []string) error {
+func runCall(ctx *context.T, env *cmdline.Env, args []string) error {
// Error-check args, and set up argsdata with a comma-separated list of
// arguments, allowing each individual arg to already be comma-separated.
//
@@ -272,7 +272,7 @@
return ret, nil
}
-func runIdentify(ctx *context.T, env *cmdline2.Env, args []string) error {
+func runIdentify(ctx *context.T, env *cmdline.Env, args []string) error {
if len(args) != 1 {
return env.UsageErrorf("wrong number of arguments")
}
diff --git a/cmd/vrpc/vrpc_test.go b/cmd/vrpc/vrpc_test.go
index 50b86bf..a6643fc 100644
--- a/cmd/vrpc/vrpc_test.go
+++ b/cmd/vrpc/vrpc_test.go
@@ -13,7 +13,7 @@
"v.io/v23"
"v.io/v23/context"
"v.io/v23/rpc"
- "v.io/x/lib/cmdline2"
+ "v.io/x/lib/cmdline"
"v.io/x/lib/vlog"
"v.io/x/ref/cmd/vrpc/internal"
"v.io/x/ref/lib/v23cmd"
@@ -142,7 +142,7 @@
ctx, name, shutdown := initTest(t)
defer shutdown()
var stdout, stderr bytes.Buffer
- env := &cmdline2.Env{Stdout: &stdout, Stderr: &stderr}
+ env := &cmdline.Env{Stdout: &stdout, Stderr: &stderr}
args := []string{"signature", fmt.Sprintf("-show-reserved=%v", showReserved), name}
if err := v23cmd.ParseAndRun(cmdVRPC, ctx, env, args); err != nil {
t.Fatalf("%s: %v", args, err)
@@ -291,7 +291,7 @@
}
for _, test := range tests {
var stdout, stderr bytes.Buffer
- env := &cmdline2.Env{Stdout: &stdout, Stderr: &stderr}
+ env := &cmdline.Env{Stdout: &stdout, Stderr: &stderr}
if err := v23cmd.ParseAndRun(cmdVRPC, ctx, env, []string{"signature", name, test.Method}); err != nil {
t.Errorf("%q failed: %v", test.Method, err)
continue
@@ -334,7 +334,7 @@
}
for _, test := range tests {
var stdout, stderr bytes.Buffer
- env := &cmdline2.Env{Stdout: &stdout, Stderr: &stderr}
+ env := &cmdline.Env{Stdout: &stdout, Stderr: &stderr}
if err := v23cmd.ParseAndRun(cmdVRPC, ctx, env, []string{"call", name, test.Method, test.InArgs}); err != nil {
t.Errorf("%q(%s) failed: %v", test.Method, test.InArgs, err)
continue
diff --git a/cmd/vrun/vrun.go b/cmd/vrun/vrun.go
index fb32d20..c34e61d 100644
--- a/cmd/vrun/vrun.go
+++ b/cmd/vrun/vrun.go
@@ -17,7 +17,7 @@
"v.io/v23"
"v.io/v23/context"
"v.io/v23/security"
- "v.io/x/lib/cmdline2"
+ "v.io/x/lib/cmdline"
"v.io/x/lib/vlog"
"v.io/x/ref/envvar"
"v.io/x/ref/lib/v23cmd"
@@ -34,7 +34,7 @@
roleFlag string
)
-var cmdVrun = &cmdline2.Command{
+var cmdVrun = &cmdline.Command{
Runner: v23cmd.RunnerFunc(vrun),
Name: "vrun",
Short: "executes commands with a derived Vanadium principal",
@@ -43,7 +43,7 @@
}
func main() {
- cmdline2.HideGlobalFlagsExcept()
+ cmdline.HideGlobalFlagsExcept()
syscall.CloseOnExec(3)
syscall.CloseOnExec(4)
@@ -51,10 +51,10 @@
cmdVrun.Flags.StringVar(&nameFlag, "name", "", "Name to use for the blessing. Uses the command name if unset.")
cmdVrun.Flags.StringVar(&roleFlag, "role", "", "Role object from which to request the blessing. If set, the blessings from this role server are used and --name is ignored. If not set, the default blessings of the calling principal are extended with --name.")
- cmdline2.Main(cmdVrun)
+ cmdline.Main(cmdVrun)
}
-func vrun(ctx *context.T, env *cmdline2.Env, args []string) error {
+func vrun(ctx *context.T, env *cmdline.Env, args []string) error {
if len(args) == 0 {
args = []string{"bash", "--norc"}
}
diff --git a/lib/v23cmd/v23cmd.go b/lib/v23cmd/v23cmd.go
index cdca697..86154a3 100644
--- a/lib/v23cmd/v23cmd.go
+++ b/lib/v23cmd/v23cmd.go
@@ -20,7 +20,7 @@
"v.io/v23"
"v.io/v23/context"
- "v.io/x/lib/cmdline2"
+ "v.io/x/lib/cmdline"
)
var (
@@ -30,7 +30,7 @@
// shrinks. Here we maintain a mapping between an index number and the
// originally registered function, so that we can look the function up in a
// typesafe manner.
- funcs []func(*context.T, *cmdline2.Env, []string) error
+ funcs []func(*context.T, *cmdline.Env, []string) error
initFn = v23.Init
)
@@ -38,7 +38,7 @@
// slice to retrieve the originally registered function.
type indexRunner uint
-func (ix indexRunner) Run(env *cmdline2.Env, args []string) error {
+func (ix indexRunner) Run(env *cmdline.Env, args []string) error {
if int(ix) < len(funcs) {
ctx, shutdown := initFn()
err := funcs[ix](ctx, env, args)
@@ -51,7 +51,7 @@
// RunnerFunc behaves similarly to cmdline.RunnerFunc, but takes a run function
// fn that includes a context as the first arg. The context is created via
// v23.Init when Run is called on the returned Runner.
-func RunnerFunc(fn func(*context.T, *cmdline2.Env, []string) error) cmdline2.Runner {
+func RunnerFunc(fn func(*context.T, *cmdline.Env, []string) error) cmdline.Runner {
ix := indexRunner(len(funcs))
funcs = append(funcs, fn)
return ix
@@ -59,7 +59,7 @@
// Lookup returns the function registered via RunnerFunc corresponding to
// runner, or nil if it doesn't exist.
-func Lookup(runner cmdline2.Runner) func(*context.T, *cmdline2.Env, []string) error {
+func Lookup(runner cmdline.Runner) func(*context.T, *cmdline.Env, []string) error {
if ix, ok := runner.(indexRunner); ok && int(ix) < len(funcs) {
return funcs[ix]
}
@@ -70,7 +70,7 @@
// args.
//
// Doesn't call v23.Init; the context initialization is up to you.
-func Run(runner cmdline2.Runner, ctx *context.T, env *cmdline2.Env, args []string) error {
+func Run(runner cmdline.Runner, ctx *context.T, env *cmdline.Env, args []string) error {
if fn := Lookup(runner); fn != nil {
return fn(ctx, env, args)
}
@@ -81,8 +81,8 @@
// the returned runner with the ctx, env and args.
//
// Doesn't call v23.Init; the context initialization is up to you.
-func ParseAndRun(cmd *cmdline2.Command, ctx *context.T, env *cmdline2.Env, args []string) error {
- runner, args, err := cmdline2.Parse(cmd, env, args)
+func ParseAndRun(cmd *cmdline.Command, ctx *context.T, env *cmdline.Env, args []string) error {
+ runner, args, err := cmdline.Parse(cmd, env, args)
if err != nil {
return err
}
diff --git a/runtime/internal/rpc/stress/mtstress/main.go b/runtime/internal/rpc/stress/mtstress/main.go
index 47a1404..b00d77e 100644
--- a/runtime/internal/rpc/stress/mtstress/main.go
+++ b/runtime/internal/rpc/stress/mtstress/main.go
@@ -18,13 +18,13 @@
"v.io/v23/naming"
"v.io/v23/options"
"v.io/v23/verror"
- "v.io/x/lib/cmdline2"
+ "v.io/x/lib/cmdline"
"v.io/x/ref/lib/v23cmd"
_ "v.io/x/ref/runtime/factories/generic"
)
func init() {
- cmdline2.HideGlobalFlagsExcept(regexp.MustCompile(`^((rate)|(duration)|(reauthenticate))$`))
+ cmdline.HideGlobalFlagsExcept(regexp.MustCompile(`^((rate)|(duration)|(reauthenticate))$`))
}
var (
@@ -32,7 +32,7 @@
duration = flag.Duration("duration", 10*time.Second, "Duration for sending test traffic and measuring latency")
reauth = flag.Bool("reauthenticate", false, "If true, establish a new authenticated connection for each RPC, simulating load from a distinct process")
- cmdMount = &cmdline2.Command{
+ cmdMount = &cmdline.Command{
Name: "mount",
Short: "Measure latency of the Mount RPC at a fixed request rate",
Long: `
@@ -46,7 +46,7 @@
seconds, 1m for 1 minute etc.
Valid time units are "ms", "s", "m", "h".
`,
- Runner: v23cmd.RunnerFunc(func(ctx *context.T, env *cmdline2.Env, args []string) error {
+ Runner: v23cmd.RunnerFunc(func(ctx *context.T, env *cmdline.Env, args []string) error {
if got, want := len(args), 2; got != want {
return env.UsageErrorf("mount: got %d arguments, want %d", got, want)
}
@@ -75,7 +75,7 @@
}),
}
- cmdResolve = &cmdline2.Command{
+ cmdResolve = &cmdline.Command{
Name: "resolve",
Short: "Measure latency of the Resolve RPC at a fixed request rate",
Long: `
@@ -85,7 +85,7 @@
ArgsLong: `
<name> the object name to resolve
`,
- Runner: v23cmd.RunnerFunc(func(ctx *context.T, env *cmdline2.Env, args []string) error {
+ Runner: v23cmd.RunnerFunc(func(ctx *context.T, env *cmdline.Env, args []string) error {
if got, want := len(args), 1; got != want {
return env.UsageErrorf("resolve: got %d arguments, want %d", got, want)
}
@@ -142,10 +142,10 @@
}
func main() {
- root := &cmdline2.Command{
+ root := &cmdline.Command{
Name: "mtstress",
Short: "Tool to stress test a mounttable service by issuing a fixed rate of requests per second and measuring latency",
- Children: []*cmdline2.Command{cmdMount, cmdResolve},
+ Children: []*cmdline.Command{cmdMount, cmdResolve},
}
- cmdline2.Main(root)
+ cmdline.Main(root)
}
diff --git a/runtime/internal/rpc/stress/stress/load.go b/runtime/internal/rpc/stress/stress/load.go
index e689f62..befbf21 100644
--- a/runtime/internal/rpc/stress/stress/load.go
+++ b/runtime/internal/rpc/stress/stress/load.go
@@ -12,7 +12,7 @@
"time"
"v.io/v23/context"
- "v.io/x/lib/cmdline2"
+ "v.io/x/lib/cmdline"
"v.io/x/ref/lib/v23cmd"
"v.io/x/ref/runtime/internal/rpc/stress/internal"
)
@@ -36,7 +36,7 @@
QpsPerCore float64
}
-var cmdLoadTest = &cmdline2.Command{
+var cmdLoadTest = &cmdline.Command{
Runner: v23cmd.RunnerFunc(runLoadTest),
Name: "load",
Short: "Run load test",
@@ -45,7 +45,7 @@
ArgsLong: "<server> ... A list of servers to connect to.",
}
-func runLoadTest(ctx *context.T, env *cmdline2.Env, args []string) error {
+func runLoadTest(ctx *context.T, env *cmdline.Env, args []string) error {
if len(args) == 0 {
return env.UsageErrorf("no server specified")
}
diff --git a/runtime/internal/rpc/stress/stress/main.go b/runtime/internal/rpc/stress/stress/main.go
index 5a2e0e7..8645cad 100644
--- a/runtime/internal/rpc/stress/stress/main.go
+++ b/runtime/internal/rpc/stress/stress/main.go
@@ -6,13 +6,13 @@
import (
"v.io/v23/context"
- "v.io/x/lib/cmdline2"
+ "v.io/x/lib/cmdline"
"v.io/x/ref/lib/v23cmd"
_ "v.io/x/ref/runtime/factories/static"
"v.io/x/ref/runtime/internal/rpc/stress"
)
-var cmdStopServers = &cmdline2.Command{
+var cmdStopServers = &cmdline.Command{
Runner: v23cmd.RunnerFunc(runStopServers),
Name: "stop",
Short: "Stop servers",
@@ -21,7 +21,7 @@
ArgsLong: "<server> ... A list of servers to stop.",
}
-func runStopServers(ctx *context.T, env *cmdline2.Env, args []string) error {
+func runStopServers(ctx *context.T, env *cmdline.Env, args []string) error {
if len(args) == 0 {
return env.UsageErrorf("no server specified")
}
@@ -34,16 +34,16 @@
}
func main() {
- cmdRoot := &cmdline2.Command{
+ cmdRoot := &cmdline.Command{
Name: "stress",
Short: "Tool to stress/load test RPC",
Long: "Tool to stress/load test RPC by issuing randomly generated requests",
- Children: []*cmdline2.Command{
+ Children: []*cmdline.Command{
cmdStressTest,
cmdStressStats,
cmdLoadTest,
cmdStopServers,
},
}
- cmdline2.Main(cmdRoot)
+ cmdline.Main(cmdRoot)
}
diff --git a/runtime/internal/rpc/stress/stress/stress.go b/runtime/internal/rpc/stress/stress/stress.go
index b63dc7a..41b6238 100644
--- a/runtime/internal/rpc/stress/stress/stress.go
+++ b/runtime/internal/rpc/stress/stress/stress.go
@@ -13,7 +13,7 @@
"time"
"v.io/v23/context"
- "v.io/x/lib/cmdline2"
+ "v.io/x/lib/cmdline"
"v.io/x/ref/lib/v23cmd"
"v.io/x/ref/runtime/internal/rpc/stress"
"v.io/x/ref/runtime/internal/rpc/stress/internal"
@@ -39,7 +39,7 @@
cmdStressStats.Flags.StringVar(&outFormat, "format", "text", "Stats output format; either text or json")
}
-var cmdStressTest = &cmdline2.Command{
+var cmdStressTest = &cmdline.Command{
Runner: v23cmd.RunnerFunc(runStressTest),
Name: "stress",
Short: "Run stress test",
@@ -48,7 +48,7 @@
ArgsLong: "<server> ... A list of servers to connect to.",
}
-func runStressTest(ctx *context.T, env *cmdline2.Env, args []string) error {
+func runStressTest(ctx *context.T, env *cmdline.Env, args []string) error {
if len(args) == 0 {
return env.UsageErrorf("no server specified")
}
@@ -99,7 +99,7 @@
return outSumStats(env.Stdout, outFormat, "client stats:", &merged)
}
-var cmdStressStats = &cmdline2.Command{
+var cmdStressStats = &cmdline.Command{
Runner: v23cmd.RunnerFunc(runStressStats),
Name: "stats",
Short: "Print out stress stats of servers",
@@ -108,7 +108,7 @@
ArgsLong: "<server> ... A list of servers to connect to.",
}
-func runStressStats(ctx *context.T, env *cmdline2.Env, args []string) error {
+func runStressStats(ctx *context.T, env *cmdline.Env, args []string) error {
if len(args) == 0 {
return env.UsageErrorf("no server specified")
}
diff --git a/services/agent/vbecome/vbecome.go b/services/agent/vbecome/vbecome.go
index fb2a28c..b4cd9f6 100644
--- a/services/agent/vbecome/vbecome.go
+++ b/services/agent/vbecome/vbecome.go
@@ -21,7 +21,7 @@
"v.io/v23"
"v.io/v23/context"
"v.io/v23/security"
- "v.io/x/lib/cmdline2"
+ "v.io/x/lib/cmdline"
"v.io/x/lib/vlog"
"v.io/x/ref/envvar"
vsecurity "v.io/x/ref/lib/security"
@@ -38,7 +38,7 @@
roleFlag string
)
-var cmdVbecome = &cmdline2.Command{
+var cmdVbecome = &cmdline.Command{
Runner: v23cmd.RunnerFunc(vbecome),
Name: "vbecome",
Short: "executes commands with a derived Vanadium principal",
@@ -50,7 +50,7 @@
const keyServerFd = 4
func main() {
- cmdline2.HideGlobalFlagsExcept()
+ cmdline.HideGlobalFlagsExcept()
syscall.CloseOnExec(childAgentFd)
syscall.CloseOnExec(keyServerFd)
@@ -58,10 +58,10 @@
cmdVbecome.Flags.StringVar(&nameFlag, "name", "", "Name to use for the blessing.")
cmdVbecome.Flags.StringVar(&roleFlag, "role", "", "Role object from which to request the blessing. If set, the blessings from this role server are used and --name is ignored. If not set, the default blessings of the calling principal are extended with --name.")
- cmdline2.Main(cmdVbecome)
+ cmdline.Main(cmdVbecome)
}
-func vbecome(ctx *context.T, env *cmdline2.Env, args []string) error {
+func vbecome(ctx *context.T, env *cmdline.Env, args []string) error {
if len(args) == 0 {
if shell := os.Getenv("SHELL"); shell != "" {
args = []string{shell}
diff --git a/services/application/application/impl.go b/services/application/application/impl.go
index d880b58..869caed 100644
--- a/services/application/application/impl.go
+++ b/services/application/application/impl.go
@@ -20,15 +20,15 @@
"v.io/v23/context"
"v.io/v23/services/application"
- "v.io/x/lib/cmdline2"
+ "v.io/x/lib/cmdline"
"v.io/x/ref/lib/v23cmd"
_ "v.io/x/ref/runtime/factories/generic"
"v.io/x/ref/services/repository"
)
func main() {
- cmdline2.HideGlobalFlagsExcept()
- cmdline2.Main(cmdRoot)
+ cmdline.HideGlobalFlagsExcept()
+ cmdline.Main(cmdRoot)
}
func getEnvelopeJSON(ctx *context.T, app repository.ApplicationClientMethods, profiles string) ([]byte, error) {
@@ -58,7 +58,7 @@
return nil
}
-func promptUser(env *cmdline2.Env, msg string) string {
+func promptUser(env *cmdline.Env, msg string) string {
fmt.Fprint(env.Stdout, msg)
var answer string
if _, err := fmt.Scanf("%s", &answer); err != nil {
@@ -67,7 +67,7 @@
return answer
}
-var cmdMatch = &cmdline2.Command{
+var cmdMatch = &cmdline.Command{
Runner: v23cmd.RunnerFunc(runMatch),
Name: "match",
Short: "Shows the first matching envelope that matches the given profiles.",
@@ -78,7 +78,7 @@
<profiles> is a comma-separated list of profiles.`,
}
-func runMatch(ctx *context.T, env *cmdline2.Env, args []string) error {
+func runMatch(ctx *context.T, env *cmdline.Env, args []string) error {
if expected, got := 2, len(args); expected != got {
return env.UsageErrorf("match: incorrect number of arguments, expected %d, got %d", expected, got)
}
@@ -92,7 +92,7 @@
return nil
}
-var cmdPut = &cmdline2.Command{
+var cmdPut = &cmdline.Command{
Runner: v23cmd.RunnerFunc(runPut),
Name: "put",
Short: "Add the given envelope to the application for the given profiles.",
@@ -105,7 +105,7 @@
not provided, the user will be prompted to enter the data manually.`,
}
-func runPut(ctx *context.T, env *cmdline2.Env, args []string) error {
+func runPut(ctx *context.T, env *cmdline.Env, args []string) error {
if got := len(args); got != 2 && got != 3 {
return env.UsageErrorf("put: incorrect number of arguments, expected 2 or 3, got %d", got)
}
@@ -134,7 +134,7 @@
return nil
}
-var cmdRemove = &cmdline2.Command{
+var cmdRemove = &cmdline.Command{
Runner: v23cmd.RunnerFunc(runRemove),
Name: "remove",
Short: "removes the application envelope for the given profile.",
@@ -145,7 +145,7 @@
<profile> is a profile.`,
}
-func runRemove(ctx *context.T, env *cmdline2.Env, args []string) error {
+func runRemove(ctx *context.T, env *cmdline.Env, args []string) error {
if expected, got := 2, len(args); expected != got {
return env.UsageErrorf("remove: incorrect number of arguments, expected %d, got %d", expected, got)
}
@@ -160,7 +160,7 @@
return nil
}
-var cmdEdit = &cmdline2.Command{
+var cmdEdit = &cmdline.Command{
Runner: v23cmd.RunnerFunc(runEdit),
Name: "edit",
Short: "edits the application envelope for the given profile.",
@@ -171,7 +171,7 @@
<profile> is a profile.`,
}
-func runEdit(ctx *context.T, env *cmdline2.Env, args []string) error {
+func runEdit(ctx *context.T, env *cmdline.Env, args []string) error {
if expected, got := 2, len(args); expected != got {
return env.UsageErrorf("edit: incorrect number of arguments, expected %d, got %d", expected, got)
}
@@ -188,7 +188,7 @@
return nil
}
-func editAndPutEnvelopeJSON(ctx *context.T, env *cmdline2.Env, app repository.ApplicationClientMethods, profile string, envData []byte) error {
+func editAndPutEnvelopeJSON(ctx *context.T, env *cmdline.Env, app repository.ApplicationClientMethods, profile string, envData []byte) error {
f, err := ioutil.TempFile("", "application-edit-")
if err != nil {
return fmt.Errorf("TempFile() failed: %v", err)
@@ -236,11 +236,11 @@
return nil
}
-var cmdRoot = &cmdline2.Command{
+var cmdRoot = &cmdline.Command{
Name: "application",
Short: "manages the Vanadium application repository",
Long: `
Command application manages the Vanadium application repository.
`,
- Children: []*cmdline2.Command{cmdMatch, cmdPut, cmdRemove, cmdEdit},
+ Children: []*cmdline.Command{cmdMatch, cmdPut, cmdRemove, cmdEdit},
}
diff --git a/services/application/application/impl_test.go b/services/application/application/impl_test.go
index b990094..d9b872f 100644
--- a/services/application/application/impl_test.go
+++ b/services/application/application/impl_test.go
@@ -18,7 +18,7 @@
"v.io/v23/security"
"v.io/v23/security/access"
"v.io/v23/services/application"
- "v.io/x/lib/cmdline2"
+ "v.io/x/lib/cmdline"
"v.io/x/lib/vlog"
"v.io/x/ref/lib/v23cmd"
_ "v.io/x/ref/runtime/factories/generic"
@@ -152,7 +152,7 @@
defer stopServer(t, server)
// Setup the command-line.
var stdout, stderr bytes.Buffer
- env := &cmdline2.Env{Stdout: &stdout, Stderr: &stderr}
+ env := &cmdline.Env{Stdout: &stdout, Stderr: &stderr}
appName := naming.JoinAddressName(endpoint.String(), "myapp/1")
profile := "myprofile"
diff --git a/services/binary/binary/impl.go b/services/binary/binary/impl.go
index 6231bef..342eb2d 100644
--- a/services/binary/binary/impl.go
+++ b/services/binary/binary/impl.go
@@ -12,18 +12,18 @@
"os"
"v.io/v23/context"
- "v.io/x/lib/cmdline2"
+ "v.io/x/lib/cmdline"
"v.io/x/ref/lib/v23cmd"
_ "v.io/x/ref/runtime/factories/generic"
"v.io/x/ref/services/internal/binarylib"
)
func main() {
- cmdline2.HideGlobalFlagsExcept()
- cmdline2.Main(cmdRoot)
+ cmdline.HideGlobalFlagsExcept()
+ cmdline.Main(cmdRoot)
}
-var cmdDelete = &cmdline2.Command{
+var cmdDelete = &cmdline.Command{
Runner: v23cmd.RunnerFunc(runDelete),
Name: "delete",
Short: "Delete a binary",
@@ -32,7 +32,7 @@
ArgsLong: "<von> is the vanadium object name of the binary to delete",
}
-func runDelete(ctx *context.T, env *cmdline2.Env, args []string) error {
+func runDelete(ctx *context.T, env *cmdline.Env, args []string) error {
if expected, got := 1, len(args); expected != got {
return env.UsageErrorf("delete: incorrect number of arguments, expected %d, got %d", expected, got)
}
@@ -44,7 +44,7 @@
return nil
}
-var cmdDownload = &cmdline2.Command{
+var cmdDownload = &cmdline.Command{
Runner: v23cmd.RunnerFunc(runDownload),
Name: "download",
Short: "Download a binary",
@@ -59,7 +59,7 @@
`,
}
-func runDownload(ctx *context.T, env *cmdline2.Env, args []string) error {
+func runDownload(ctx *context.T, env *cmdline.Env, args []string) error {
if expected, got := 2, len(args); expected != got {
return env.UsageErrorf("download: incorrect number of arguments, expected %d, got %d", expected, got)
}
@@ -71,7 +71,7 @@
return nil
}
-var cmdUpload = &cmdline2.Command{
+var cmdUpload = &cmdline.Command{
Runner: v23cmd.RunnerFunc(runUpload),
Name: "upload",
Short: "Upload a binary or directory archive",
@@ -86,7 +86,7 @@
`,
}
-func runUpload(ctx *context.T, env *cmdline2.Env, args []string) error {
+func runUpload(ctx *context.T, env *cmdline.Env, args []string) error {
if expected, got := 2, len(args); expected != got {
return env.UsageErrorf("upload: incorrect number of arguments, expected %d, got %d", expected, got)
}
@@ -111,7 +111,7 @@
return nil
}
-var cmdURL = &cmdline2.Command{
+var cmdURL = &cmdline.Command{
Runner: v23cmd.RunnerFunc(runURL),
Name: "url",
Short: "Fetch a download URL",
@@ -120,7 +120,7 @@
ArgsLong: "<von> is the vanadium object name of the binary repository",
}
-func runURL(ctx *context.T, env *cmdline2.Env, args []string) error {
+func runURL(ctx *context.T, env *cmdline.Env, args []string) error {
if expected, got := 1, len(args); expected != got {
return env.UsageErrorf("rooturl: incorrect number of arguments, expected %d, got %d", expected, got)
}
@@ -133,11 +133,11 @@
return nil
}
-var cmdRoot = &cmdline2.Command{
+var cmdRoot = &cmdline.Command{
Name: "binary",
Short: "manages the Vanadium binary repository",
Long: `
Command binary manages the Vanadium binary repository.
`,
- Children: []*cmdline2.Command{cmdDelete, cmdDownload, cmdUpload, cmdURL},
+ Children: []*cmdline.Command{cmdDelete, cmdDownload, cmdUpload, cmdURL},
}
diff --git a/services/binary/binary/impl_test.go b/services/binary/binary/impl_test.go
index 7854fda..85414b3 100644
--- a/services/binary/binary/impl_test.go
+++ b/services/binary/binary/impl_test.go
@@ -23,7 +23,7 @@
"v.io/v23/security/access"
"v.io/v23/services/binary"
"v.io/v23/services/repository"
- "v.io/x/lib/cmdline2"
+ "v.io/x/lib/cmdline"
"v.io/x/lib/vlog"
"v.io/x/ref/lib/v23cmd"
_ "v.io/x/ref/runtime/factories/generic"
@@ -138,7 +138,7 @@
// Setup the command-line.
var out bytes.Buffer
- env := &cmdline2.Env{Stdout: &out, Stderr: &out}
+ env := &cmdline.Env{Stdout: &out, Stderr: &out}
// Test the 'delete' command.
if err := v23cmd.ParseAndRun(cmdRoot, ctx, env, []string{"delete", naming.JoinAddressName(endpoint.String(), "exists")}); err != nil {
diff --git a/services/build/build/impl.go b/services/build/build/impl.go
index 22d838a..abe2639 100644
--- a/services/build/build/impl.go
+++ b/services/build/build/impl.go
@@ -19,13 +19,13 @@
"v.io/v23/context"
vbuild "v.io/v23/services/build"
- "v.io/x/lib/cmdline2"
+ "v.io/x/lib/cmdline"
"v.io/x/ref/lib/v23cmd"
_ "v.io/x/ref/runtime/factories/generic"
)
func main() {
- cmdline2.Main(cmdRoot)
+ cmdline.Main(cmdRoot)
}
var (
@@ -34,23 +34,23 @@
)
func init() {
- cmdline2.HideGlobalFlagsExcept()
+ cmdline.HideGlobalFlagsExcept()
cmdBuild.Flags.StringVar(&flagArch, "arch", runtime.GOARCH, "Target architecture. The default is the value of runtime.GOARCH.")
cmdBuild.Flags.Lookup("arch").DefValue = "<runtime.GOARCH>"
cmdBuild.Flags.StringVar(&flagOS, "os", runtime.GOOS, "Target operating system. The default is the value of runtime.GOOS.")
cmdBuild.Flags.Lookup("os").DefValue = "<runtime.GOOS>"
}
-var cmdRoot = &cmdline2.Command{
+var cmdRoot = &cmdline.Command{
Name: "build",
Short: "sends commands to a Vanadium build server",
Long: `
Command build sends commands to a Vanadium build server.
`,
- Children: []*cmdline2.Command{cmdBuild},
+ Children: []*cmdline.Command{cmdBuild},
}
-var cmdBuild = &cmdline2.Command{
+var cmdBuild = &cmdline.Command{
Runner: v23cmd.RunnerFunc(runBuild),
Name: "build",
Short: "Build vanadium Go packages",
@@ -226,7 +226,7 @@
// concurrently 1) reads the source files, 2) sends them to the build
// server and receives binaries from the build server, and 3) writes
// the binaries out to the disk.
-func runBuild(ctx *context.T, env *cmdline2.Env, args []string) error {
+func runBuild(ctx *context.T, env *cmdline.Env, args []string) error {
name, paths := args[0], args[1:]
pkgMap := map[string]*build.Package{}
if err := importPackages(paths, pkgMap); err != nil {
diff --git a/services/build/build/impl_test.go b/services/build/build/impl_test.go
index f60b3db..4df3e5a 100644
--- a/services/build/build/impl_test.go
+++ b/services/build/build/impl_test.go
@@ -16,7 +16,7 @@
"v.io/v23/services/binary"
"v.io/v23/services/build"
"v.io/v23/verror"
- "v.io/x/lib/cmdline2"
+ "v.io/x/lib/cmdline"
"v.io/x/lib/vlog"
"v.io/x/ref/lib/v23cmd"
_ "v.io/x/ref/runtime/factories/generic"
@@ -77,7 +77,7 @@
defer stopServer(t, server)
var stdout, stderr bytes.Buffer
- env := &cmdline2.Env{Stdout: &stdout, Stderr: &stderr}
+ env := &cmdline.Env{Stdout: &stdout, Stderr: &stderr}
args := []string{"build", naming.JoinAddressName(endpoint.String(), ""), "v.io/x/ref/services/build/build"}
if err := v23cmd.ParseAndRun(cmdRoot, ctx, env, args); err != nil {
t.Fatalf("Run failed: %v", err)
diff --git a/services/debug/debug/impl.go b/services/debug/debug/impl.go
index a9a604a..a35a70b 100644
--- a/services/debug/debug/impl.go
+++ b/services/debug/debug/impl.go
@@ -28,7 +28,7 @@
"v.io/v23/uniqueid"
"v.io/v23/vdl"
"v.io/v23/vtrace"
- "v.io/x/lib/cmdline2"
+ "v.io/x/lib/cmdline"
"v.io/x/ref/lib/glob"
"v.io/x/ref/lib/signals"
"v.io/x/ref/lib/v23cmd"
@@ -37,7 +37,7 @@
)
func main() {
- cmdline2.Main(cmdRoot)
+ cmdline.Main(cmdRoot)
}
var (
@@ -51,7 +51,7 @@
)
func init() {
- cmdline2.HideGlobalFlagsExcept()
+ cmdline.HideGlobalFlagsExcept()
// logs read flags
cmdLogsRead.Flags.BoolVar(&follow, "f", false, "When true, read will wait for new log entries when it reaches the end of the file.")
@@ -71,7 +71,7 @@
cmdPProfRun.Flags.StringVar(&pprofCmd, "pprofcmd", "v23 go tool pprof", "The pprof command to use.")
}
-var cmdVtrace = &cmdline2.Command{
+var cmdVtrace = &cmdline.Command{
Runner: v23cmd.RunnerFunc(runVtrace),
Name: "vtrace",
Short: "Returns vtrace traces.",
@@ -95,7 +95,7 @@
}
}
-func runVtrace(ctx *context.T, env *cmdline2.Env, args []string) error {
+func runVtrace(ctx *context.T, env *cmdline.Env, args []string) error {
arglen := len(args)
if arglen == 0 {
return env.UsageErrorf("vtrace: incorrect number of arguments, got %d want >= 1", arglen)
@@ -145,7 +145,7 @@
return <-errors
}
-var cmdGlob = &cmdline2.Command{
+var cmdGlob = &cmdline.Command{
Runner: v23cmd.RunnerFunc(runGlob),
Name: "glob",
Short: "Returns all matching entries from the namespace.",
@@ -156,7 +156,7 @@
`,
}
-func runGlob(ctx *context.T, env *cmdline2.Env, args []string) error {
+func runGlob(ctx *context.T, env *cmdline.Env, args []string) error {
if min, got := 1, len(args); got < min {
return env.UsageErrorf("glob: incorrect number of arguments, got %d, want >=%d", got, min)
}
@@ -216,7 +216,7 @@
}
}
-var cmdLogsRead = &cmdline2.Command{
+var cmdLogsRead = &cmdline.Command{
Runner: v23cmd.RunnerFunc(runLogsRead),
Name: "read",
Short: "Reads the content of a log file object.",
@@ -227,7 +227,7 @@
`,
}
-func runLogsRead(ctx *context.T, env *cmdline2.Env, args []string) error {
+func runLogsRead(ctx *context.T, env *cmdline.Env, args []string) error {
if want, got := 1, len(args); want != got {
return env.UsageErrorf("read: incorrect number of arguments, got %d, want %d", got, want)
}
@@ -259,7 +259,7 @@
return nil
}
-var cmdLogsSize = &cmdline2.Command{
+var cmdLogsSize = &cmdline.Command{
Runner: v23cmd.RunnerFunc(runLogsSize),
Name: "size",
Short: "Returns the size of a log file object.",
@@ -270,7 +270,7 @@
`,
}
-func runLogsSize(ctx *context.T, env *cmdline2.Env, args []string) error {
+func runLogsSize(ctx *context.T, env *cmdline.Env, args []string) error {
if want, got := 1, len(args); want != got {
return env.UsageErrorf("size: incorrect number of arguments, got %d, want %d", got, want)
}
@@ -284,7 +284,7 @@
return nil
}
-var cmdStatsRead = &cmdline2.Command{
+var cmdStatsRead = &cmdline.Command{
Runner: v23cmd.RunnerFunc(runStatsRead),
Name: "read",
Short: "Returns the value of stats objects.",
@@ -296,7 +296,7 @@
`,
}
-func runStatsRead(ctx *context.T, env *cmdline2.Env, args []string) error {
+func runStatsRead(ctx *context.T, env *cmdline.Env, args []string) error {
if min, got := 1, len(args); got < min {
return env.UsageErrorf("read: incorrect number of arguments, got %d, want >=%d", got, min)
}
@@ -350,7 +350,7 @@
output <- fmt.Sprintf("%s: %v", name, fv)
}
-var cmdStatsWatch = &cmdline2.Command{
+var cmdStatsWatch = &cmdline.Command{
Runner: v23cmd.RunnerFunc(runStatsWatch),
Name: "watch",
Short: "Returns a stream of all matching entries and their values as they change.",
@@ -361,7 +361,7 @@
`,
}
-func runStatsWatch(ctx *context.T, env *cmdline2.Env, args []string) error {
+func runStatsWatch(ctx *context.T, env *cmdline.Env, args []string) error {
if want, got := 1, len(args); got < want {
return env.UsageErrorf("watch: incorrect number of arguments, got %d, want >=%d", got, want)
}
@@ -456,7 +456,7 @@
return ret + fmt.Sprint(pretty), err
}
-var cmdPProfRun = &cmdline2.Command{
+var cmdPProfRun = &cmdline.Command{
Runner: v23cmd.RunnerFunc(runPProf),
Name: "run",
Short: "Runs the pprof tool.",
@@ -473,7 +473,7 @@
`,
}
-func runPProf(ctx *context.T, env *cmdline2.Env, args []string) error {
+func runPProf(ctx *context.T, env *cmdline.Env, args []string) error {
if min, got := 1, len(args); got < min {
return env.UsageErrorf("pprof: incorrect number of arguments, got %d, want >=%d", got, min)
}
@@ -504,7 +504,7 @@
return c.Run()
}
-func showPProfProfiles(ctx *context.T, env *cmdline2.Env, name string) error {
+func showPProfProfiles(ctx *context.T, env *cmdline.Env, name string) error {
v, err := pprof.PProfClient(name).Profiles(ctx)
if err != nil {
return err
@@ -526,7 +526,7 @@
return `"` + re.ReplaceAllString(s, "\\$1") + `"`
}
-var cmdPProfRunProxy = &cmdline2.Command{
+var cmdPProfRunProxy = &cmdline.Command{
Runner: v23cmd.RunnerFunc(runPProfProxy),
Name: "proxy",
Short: "Runs an http proxy to a pprof object.",
@@ -537,7 +537,7 @@
`,
}
-func runPProfProxy(ctx *context.T, env *cmdline2.Env, args []string) error {
+func runPProfProxy(ctx *context.T, env *cmdline.Env, args []string) error {
if want, got := 1, len(args); got != want {
return env.UsageErrorf("proxy: incorrect number of arguments, got %d, want %d", got, want)
}
@@ -557,30 +557,30 @@
return nil
}
-var cmdRoot = &cmdline2.Command{
+var cmdRoot = &cmdline.Command{
Name: "debug",
Short: "supports debugging Vanadium servers.",
Long: "Command debug supports debugging Vanadium servers.",
- Children: []*cmdline2.Command{
+ Children: []*cmdline.Command{
cmdGlob,
cmdVtrace,
- &cmdline2.Command{
+ &cmdline.Command{
Name: "logs",
Short: "Accesses log files",
Long: "Accesses log files",
- Children: []*cmdline2.Command{cmdLogsRead, cmdLogsSize},
+ Children: []*cmdline.Command{cmdLogsRead, cmdLogsSize},
},
- &cmdline2.Command{
+ &cmdline.Command{
Name: "stats",
Short: "Accesses stats",
Long: "Accesses stats",
- Children: []*cmdline2.Command{cmdStatsRead, cmdStatsWatch},
+ Children: []*cmdline.Command{cmdStatsRead, cmdStatsWatch},
},
- &cmdline2.Command{
+ &cmdline.Command{
Name: "pprof",
Short: "Accesses profiling data",
Long: "Accesses profiling data",
- Children: []*cmdline2.Command{cmdPProfRun, cmdPProfRunProxy},
+ Children: []*cmdline.Command{cmdPProfRun, cmdPProfRunProxy},
},
},
}
diff --git a/services/device/device/acl_impl.go b/services/device/device/acl_impl.go
index 34b7a40..3c9973e 100644
--- a/services/device/device/acl_impl.go
+++ b/services/device/device/acl_impl.go
@@ -14,11 +14,11 @@
"v.io/v23/security/access"
"v.io/v23/services/device"
"v.io/v23/verror"
- "v.io/x/lib/cmdline2"
+ "v.io/x/lib/cmdline"
"v.io/x/ref/lib/v23cmd"
)
-var cmdGet = &cmdline2.Command{
+var cmdGet = &cmdline.Command{
Runner: v23cmd.RunnerFunc(runGet),
Name: "get",
Short: "Get Permissions for the given target.",
@@ -29,7 +29,7 @@
application installation or instance.`,
}
-func runGet(ctx *context.T, env *cmdline2.Env, args []string) error {
+func runGet(ctx *context.T, env *cmdline.Env, args []string) error {
if expected, got := 1, len(args); expected != got {
return env.UsageErrorf("get: incorrect number of arguments, expected %d, got %d", expected, got)
}
@@ -56,7 +56,7 @@
// TODO(caprita): Add unit test logic for 'force set'.
var forceSet bool
-var cmdSet = &cmdline2.Command{
+var cmdSet = &cmdline.Command{
Runner: v23cmd.RunnerFunc(runSet),
Name: "set",
Short: "Set Permissions for the given target.",
@@ -89,7 +89,7 @@
cmdSet.Flags.BoolVar(&forceSet, "f", false, "Instead of making the AccessLists additive, do a complete replacement based on the specified settings.")
}
-func runSet(ctx *context.T, env *cmdline2.Env, args []string) error {
+func runSet(ctx *context.T, env *cmdline.Env, args []string) error {
if got := len(args); !((got%2) == 1 && got >= 3) {
return env.UsageErrorf("set: incorrect number of arguments %d, must be 1 + 2n", got)
}
@@ -136,11 +136,11 @@
}
}
-var cmdACL = &cmdline2.Command{
+var cmdACL = &cmdline.Command{
Name: "acl",
Short: "Tool for setting device manager Permissions",
Long: `
The acl tool manages Permissions on the device manger, installations and instances.
`,
- Children: []*cmdline2.Command{cmdGet, cmdSet},
+ Children: []*cmdline.Command{cmdGet, cmdSet},
}
diff --git a/services/device/device/acl_test.go b/services/device/device/acl_test.go
index 3cc5988..3e76185 100644
--- a/services/device/device/acl_test.go
+++ b/services/device/device/acl_test.go
@@ -14,7 +14,7 @@
"v.io/v23/security"
"v.io/v23/security/access"
"v.io/v23/verror"
- "v.io/x/lib/cmdline2"
+ "v.io/x/lib/cmdline"
"v.io/x/ref/lib/v23cmd"
"v.io/x/ref/test"
@@ -41,7 +41,7 @@
// Setup the command-line.
cmd := cmd_device.CmdRoot
var stdout, stderr bytes.Buffer
- env := &cmdline2.Env{Stdout: &stdout, Stderr: &stderr}
+ env := &cmdline.Env{Stdout: &stdout, Stderr: &stderr}
deviceName := endpoint.Name()
// Test the 'get' command.
@@ -89,7 +89,7 @@
// Setup the command-line.
cmd := cmd_device.CmdRoot
var stdout, stderr bytes.Buffer
- env := &cmdline2.Env{Stdout: &stdout, Stderr: &stderr}
+ env := &cmdline.Env{Stdout: &stdout, Stderr: &stderr}
deviceName := endpoint.Name()
// Some tests to validate parse.
diff --git a/services/device/device/associate_impl.go b/services/device/device/associate_impl.go
index 6c1e634..a22d394 100644
--- a/services/device/device/associate_impl.go
+++ b/services/device/device/associate_impl.go
@@ -10,11 +10,11 @@
"v.io/v23/context"
"v.io/v23/services/device"
- "v.io/x/lib/cmdline2"
+ "v.io/x/lib/cmdline"
"v.io/x/ref/lib/v23cmd"
)
-var cmdList = &cmdline2.Command{
+var cmdList = &cmdline.Command{
Runner: v23cmd.RunnerFunc(runList),
Name: "list",
Short: "Lists the account associations.",
@@ -24,7 +24,7 @@
<devicemanager> is the name of the device manager to connect to.`,
}
-func runList(ctx *context.T, env *cmdline2.Env, args []string) error {
+func runList(ctx *context.T, env *cmdline.Env, args []string) error {
if expected, got := 1, len(args); expected != got {
return env.UsageErrorf("list: incorrect number of arguments, expected %d, got %d", expected, got)
}
@@ -42,7 +42,7 @@
return nil
}
-var cmdAdd = &cmdline2.Command{
+var cmdAdd = &cmdline.Command{
Runner: v23cmd.RunnerFunc(runAdd),
Name: "add",
Short: "Add the listed blessings with the specified system account.",
@@ -54,7 +54,7 @@
<blessing>.. are the blessings to associate systemAccount with.`,
}
-func runAdd(ctx *context.T, env *cmdline2.Env, args []string) error {
+func runAdd(ctx *context.T, env *cmdline.Env, args []string) error {
if expected, got := 3, len(args); got < expected {
return env.UsageErrorf("add: incorrect number of arguments, expected at least %d, got %d", expected, got)
}
@@ -63,7 +63,7 @@
return device.DeviceClient(args[0]).AssociateAccount(ctx, args[2:], args[1])
}
-var cmdRemove = &cmdline2.Command{
+var cmdRemove = &cmdline.Command{
Runner: v23cmd.RunnerFunc(runRemove),
Name: "remove",
Short: "Removes system accounts associated with the listed blessings.",
@@ -74,7 +74,7 @@
<blessing>... is a list of blessings.`,
}
-func runRemove(ctx *context.T, env *cmdline2.Env, args []string) error {
+func runRemove(ctx *context.T, env *cmdline.Env, args []string) error {
if expected, got := 2, len(args); got < expected {
return env.UsageErrorf("remove: incorrect number of arguments, expected at least %d, got %d", expected, got)
}
@@ -83,11 +83,11 @@
return device.DeviceClient(args[0]).AssociateAccount(ctx, args[1:], "")
}
-var cmdAssociate = &cmdline2.Command{
+var cmdAssociate = &cmdline.Command{
Name: "associate",
Short: "Tool for creating associations between Vanadium blessings and a system account",
Long: `
The associate tool facilitates managing blessing to system account associations.
`,
- Children: []*cmdline2.Command{cmdList, cmdAdd, cmdRemove},
+ Children: []*cmdline.Command{cmdList, cmdAdd, cmdRemove},
}
diff --git a/services/device/device/impl.go b/services/device/device/impl.go
index 6ebcc63..15bd2ef 100644
--- a/services/device/device/impl.go
+++ b/services/device/device/impl.go
@@ -17,7 +17,7 @@
"v.io/v23/security"
"v.io/v23/services/application"
"v.io/v23/services/device"
- "v.io/x/lib/cmdline2"
+ "v.io/x/lib/cmdline"
"v.io/x/ref/lib/v23cmd"
)
@@ -56,7 +56,7 @@
cmdInstall.Flags.Var(&packagesOverride, "packages", "JSON-encoded application.Packages object, of the form: '{\"pkg1\":{\"File\":\"object name 1\"},\"pkg2\":{\"File\":\"object name 2\"}}'")
}
-var cmdInstall = &cmdline2.Command{
+var cmdInstall = &cmdline.Command{
Runner: v23cmd.RunnerFunc(runInstall),
Name: "install",
Short: "Install the given application.",
@@ -69,7 +69,7 @@
`,
}
-func runInstall(ctx *context.T, env *cmdline2.Env, args []string) error {
+func runInstall(ctx *context.T, env *cmdline.Env, args []string) error {
if expected, got := 2, len(args); expected != got {
return env.UsageErrorf("install: incorrect number of arguments, expected %d, got %d", expected, got)
}
@@ -87,7 +87,7 @@
return nil
}
-var cmdUninstall = &cmdline2.Command{
+var cmdUninstall = &cmdline.Command{
Runner: v23cmd.RunnerFunc(runUninstall),
Name: "uninstall",
Short: "Uninstall the given application installation.",
@@ -99,7 +99,7 @@
`,
}
-func runUninstall(ctx *context.T, env *cmdline2.Env, args []string) error {
+func runUninstall(ctx *context.T, env *cmdline.Env, args []string) error {
if expected, got := 1, len(args); expected != got {
return env.UsageErrorf("uninstall: incorrect number of arguments, expected %d, got %d", expected, got)
}
@@ -111,7 +111,7 @@
return nil
}
-var cmdInstantiate = &cmdline2.Command{
+var cmdInstantiate = &cmdline.Command{
Runner: v23cmd.RunnerFunc(runInstantiate),
Name: "instantiate",
Short: "Create an instance of the given application.",
@@ -135,7 +135,7 @@
return p.Bless(call.RemoteBlessings().PublicKey(), p.BlessingStore().Default(), g.extension, security.UnconstrainedUse())
}
-func runInstantiate(ctx *context.T, env *cmdline2.Env, args []string) error {
+func runInstantiate(ctx *context.T, env *cmdline.Env, args []string) error {
if expected, got := 2, len(args); expected != got {
return env.UsageErrorf("instantiate: incorrect number of arguments, expected %d, got %d", expected, got)
}
@@ -174,7 +174,7 @@
return nil
}
-var cmdClaim = &cmdline2.Command{
+var cmdClaim = &cmdline.Command{
Runner: v23cmd.RunnerFunc(runClaim),
Name: "claim",
Short: "Claim the device.",
@@ -193,7 +193,7 @@
are claiming.`,
}
-func runClaim(ctx *context.T, env *cmdline2.Env, args []string) error {
+func runClaim(ctx *context.T, env *cmdline.Env, args []string) error {
if expected, max, got := 2, 4, len(args); expected > got || got > max {
return env.UsageErrorf("claim: incorrect number of arguments, expected atleast %d (max: %d), got %d", expected, max, got)
}
@@ -223,7 +223,7 @@
return nil
}
-var cmdDescribe = &cmdline2.Command{
+var cmdDescribe = &cmdline.Command{
Runner: v23cmd.RunnerFunc(runDescribe),
Name: "describe",
Short: "Describe the device.",
@@ -233,7 +233,7 @@
<device> is the vanadium object name of the device manager's device service.`,
}
-func runDescribe(ctx *context.T, env *cmdline2.Env, args []string) error {
+func runDescribe(ctx *context.T, env *cmdline.Env, args []string) error {
if expected, got := 1, len(args); expected != got {
return env.UsageErrorf("describe: incorrect number of arguments, expected %d, got %d", expected, got)
}
@@ -246,7 +246,7 @@
return nil
}
-var cmdUpdate = &cmdline2.Command{
+var cmdUpdate = &cmdline.Command{
Runner: v23cmd.RunnerFunc(runUpdate),
Name: "update",
Short: "Update the device manager or application",
@@ -257,7 +257,7 @@
installation or instance to update.`,
}
-func runUpdate(ctx *context.T, env *cmdline2.Env, args []string) error {
+func runUpdate(ctx *context.T, env *cmdline.Env, args []string) error {
if expected, got := 1, len(args); expected != got {
return env.UsageErrorf("update: incorrect number of arguments, expected %d, got %d", expected, got)
}
@@ -269,7 +269,7 @@
return nil
}
-var cmdRevert = &cmdline2.Command{
+var cmdRevert = &cmdline.Command{
Runner: v23cmd.RunnerFunc(runRevert),
Name: "revert",
Short: "Revert the device manager or application",
@@ -280,7 +280,7 @@
installation to revert.`,
}
-func runRevert(ctx *context.T, env *cmdline2.Env, args []string) error {
+func runRevert(ctx *context.T, env *cmdline.Env, args []string) error {
if expected, got := 1, len(args); expected != got {
return env.UsageErrorf("revert: incorrect number of arguments, expected %d, got %d", expected, got)
}
@@ -292,7 +292,7 @@
return nil
}
-var cmdDebug = &cmdline2.Command{
+var cmdDebug = &cmdline.Command{
Runner: v23cmd.RunnerFunc(runDebug),
Name: "debug",
Short: "Debug the device.",
@@ -302,7 +302,7 @@
<app name> is the vanadium object name of an app installation or instance.`,
}
-func runDebug(ctx *context.T, env *cmdline2.Env, args []string) error {
+func runDebug(ctx *context.T, env *cmdline.Env, args []string) error {
if expected, got := 1, len(args); expected != got {
return env.UsageErrorf("debug: incorrect number of arguments, expected %d, got %d", expected, got)
}
@@ -315,7 +315,7 @@
return nil
}
-var cmdStatus = &cmdline2.Command{
+var cmdStatus = &cmdline.Command{
Runner: v23cmd.RunnerFunc(runStatus),
Name: "status",
Short: "Get application status.",
@@ -325,7 +325,7 @@
<app name> is the vanadium object name of an app installation or instance.`,
}
-func runStatus(ctx *context.T, env *cmdline2.Env, args []string) error {
+func runStatus(ctx *context.T, env *cmdline.Env, args []string) error {
if expected, got := 1, len(args); expected != got {
return env.UsageErrorf("status: incorrect number of arguments, expected %d, got %d", expected, got)
}
diff --git a/services/device/device/impl_test.go b/services/device/device/impl_test.go
index ddd7f3b..fdef9b9 100644
--- a/services/device/device/impl_test.go
+++ b/services/device/device/impl_test.go
@@ -18,7 +18,7 @@
"v.io/v23/services/application"
"v.io/v23/services/device"
"v.io/v23/verror"
- "v.io/x/lib/cmdline2"
+ "v.io/x/lib/cmdline"
"v.io/x/ref/lib/security"
"v.io/x/ref/lib/v23cmd"
"v.io/x/ref/test"
@@ -42,7 +42,7 @@
// Setup the command-line.
cmd := cmd_device.CmdRoot
var stdout, stderr bytes.Buffer
- env := &cmdline2.Env{Stdout: &stdout, Stderr: &stderr}
+ env := &cmdline.Env{Stdout: &stdout, Stderr: &stderr}
deviceName := naming.JoinAddressName(endpoint.String(), "")
rootTape := tapes.forSuffix("")
@@ -96,7 +96,7 @@
// Setup the command-line.
cmd := cmd_device.CmdRoot
var stdout, stderr bytes.Buffer
- env := &cmdline2.Env{Stdout: &stdout, Stderr: &stderr}
+ env := &cmdline.Env{Stdout: &stdout, Stderr: &stderr}
deviceName := naming.JoinAddressName(endpoint.String(), "")
if err := v23cmd.ParseAndRun(cmd, ctx, env, []string{"add", "one"}); err == nil {
@@ -148,7 +148,7 @@
// Setup the command-line.
cmd := cmd_device.CmdRoot
var stdout, stderr bytes.Buffer
- env := &cmdline2.Env{Stdout: &stdout, Stderr: &stderr}
+ env := &cmdline.Env{Stdout: &stdout, Stderr: &stderr}
deviceName := naming.JoinAddressName(endpoint.String(), "")
if err := v23cmd.ParseAndRun(cmd, ctx, env, []string{"remove", "one"}); err == nil {
@@ -187,7 +187,7 @@
// Setup the command-line.
cmd := cmd_device.CmdRoot
var stdout, stderr bytes.Buffer
- env := &cmdline2.Env{Stdout: &stdout, Stderr: &stderr}
+ env := &cmdline.Env{Stdout: &stdout, Stderr: &stderr}
deviceName := naming.JoinAddressName(endpoint.String(), "")
appId := "myBestAppID"
cfg := device.Config{"someflag": "somevalue"}
@@ -296,7 +296,7 @@
// Setup the command-line.
cmd := cmd_device.CmdRoot
var stdout, stderr bytes.Buffer
- env := &cmdline2.Env{Stdout: &stdout, Stderr: &stderr}
+ env := &cmdline.Env{Stdout: &stdout, Stderr: &stderr}
deviceName := naming.JoinAddressName(endpoint.String(), "")
deviceKey, err := v23.GetPrincipal(ctx).PublicKey().MarshalBinary()
if err != nil {
@@ -394,7 +394,7 @@
// Setup the command-line.
cmd := cmd_device.CmdRoot
var stdout, stderr bytes.Buffer
- env := &cmdline2.Env{Stdout: &stdout, Stderr: &stderr}
+ env := &cmdline.Env{Stdout: &stdout, Stderr: &stderr}
appName := naming.JoinAddressName(endpoint.String(), "")
// Confirm that we correctly enforce the number of arguments.
@@ -473,7 +473,7 @@
// Setup the command-line.
cmd := cmd_device.CmdRoot
var stdout, stderr bytes.Buffer
- env := &cmdline2.Env{Stdout: &stdout, Stderr: &stderr}
+ env := &cmdline.Env{Stdout: &stdout, Stderr: &stderr}
appName := naming.JoinAddressName(endpoint.String(), "")
debugMessage := "the secrets of the universe, revealed"
@@ -502,7 +502,7 @@
// Setup the command-line.
cmd := cmd_device.CmdRoot
var stdout, stderr bytes.Buffer
- env := &cmdline2.Env{Stdout: &stdout, Stderr: &stderr}
+ env := &cmdline.Env{Stdout: &stdout, Stderr: &stderr}
appName := naming.JoinAddressName(endpoint.String(), "")
rootTape := tapes.forSuffix("")
diff --git a/services/device/device/instance_impl.go b/services/device/device/instance_impl.go
index e1bcd82..779f9bd 100644
--- a/services/device/device/instance_impl.go
+++ b/services/device/device/instance_impl.go
@@ -12,11 +12,11 @@
"v.io/v23/context"
"v.io/v23/services/device"
- "v.io/x/lib/cmdline2"
+ "v.io/x/lib/cmdline"
"v.io/x/ref/lib/v23cmd"
)
-var cmdDelete = &cmdline2.Command{
+var cmdDelete = &cmdline.Command{
Runner: v23cmd.RunnerFunc(runDelete),
Name: "delete",
Short: "Delete the given application instance.",
@@ -26,7 +26,7 @@
<app instance> is the vanadium object name of the application instance to delete.`,
}
-func runDelete(ctx *context.T, env *cmdline2.Env, args []string) error {
+func runDelete(ctx *context.T, env *cmdline.Env, args []string) error {
if expected, got := 1, len(args); expected != got {
return env.UsageErrorf("delete: incorrect number of arguments, expected %d, got %d", expected, got)
}
@@ -41,7 +41,7 @@
const killDeadline = 10 * time.Second
-var cmdKill = &cmdline2.Command{
+var cmdKill = &cmdline.Command{
Runner: v23cmd.RunnerFunc(runKill),
Name: "kill",
Short: "Kill the given application instance.",
@@ -51,7 +51,7 @@
<app instance> is the vanadium object name of the application instance to kill.`,
}
-func runKill(ctx *context.T, env *cmdline2.Env, args []string) error {
+func runKill(ctx *context.T, env *cmdline.Env, args []string) error {
if expected, got := 1, len(args); expected != got {
return env.UsageErrorf("kill: incorrect number of arguments, expected %d, got %d", expected, got)
}
@@ -64,7 +64,7 @@
return nil
}
-var cmdRun = &cmdline2.Command{
+var cmdRun = &cmdline.Command{
Runner: v23cmd.RunnerFunc(runRun),
Name: "run",
Short: "Run the given application instance.",
@@ -74,7 +74,7 @@
<app instance> is the vanadium object name of the application instance to run.`,
}
-func runRun(ctx *context.T, env *cmdline2.Env, args []string) error {
+func runRun(ctx *context.T, env *cmdline.Env, args []string) error {
if expected, got := 1, len(args); expected != got {
return env.UsageErrorf("run: incorrect number of arguments, expected %d, got %d", expected, got)
}
diff --git a/services/device/device/instance_impl_test.go b/services/device/device/instance_impl_test.go
index d072b04..6f56cc2 100644
--- a/services/device/device/instance_impl_test.go
+++ b/services/device/device/instance_impl_test.go
@@ -13,7 +13,7 @@
"v.io/v23/naming"
"v.io/v23/verror"
- "v.io/x/lib/cmdline2"
+ "v.io/x/lib/cmdline"
"v.io/x/ref/lib/v23cmd"
"v.io/x/ref/test"
@@ -34,7 +34,7 @@
// Setup the command-line.
cmd := cmd_device.CmdRoot
var stdout, stderr bytes.Buffer
- env := &cmdline2.Env{Stdout: &stdout, Stderr: &stderr}
+ env := &cmdline.Env{Stdout: &stdout, Stderr: &stderr}
appName := naming.JoinAddressName(endpoint.String(), "appname")
// Confirm that we correctly enforce the number of arguments.
@@ -107,7 +107,7 @@
// Setup the command-line.
cmd := cmd_device.CmdRoot
var stdout, stderr bytes.Buffer
- env := &cmdline2.Env{Stdout: &stdout, Stderr: &stderr}
+ env := &cmdline.Env{Stdout: &stdout, Stderr: &stderr}
appName := naming.JoinAddressName(endpoint.String(), "appname")
// Confirm that we correctly enforce the number of arguments.
diff --git a/services/device/device/local_install.go b/services/device/device/local_install.go
index f0ef6c3..c2cf446 100644
--- a/services/device/device/local_install.go
+++ b/services/device/device/local_install.go
@@ -27,12 +27,12 @@
"v.io/v23/uniqueid"
"v.io/x/lib/vlog"
- "v.io/x/lib/cmdline2"
+ "v.io/x/lib/cmdline"
"v.io/x/ref/lib/v23cmd"
"v.io/x/ref/services/internal/packages"
)
-var cmdInstallLocal = &cmdline2.Command{
+var cmdInstallLocal = &cmdline.Command{
Runner: v23cmd.RunnerFunc(runInstallLocal),
Name: "install-local",
Short: "Install the given application from the local system.",
@@ -251,7 +251,7 @@
// TODO(caprita/ashankar): We should use bi-directional streams to get this
// working over the same connection that the command makes to the device
// manager.
-func runInstallLocal(ctx *context.T, env *cmdline2.Env, args []string) error {
+func runInstallLocal(ctx *context.T, env *cmdline.Env, args []string) error {
if expectedMin, got := 2, len(args); got < expectedMin {
return env.UsageErrorf("install-local: incorrect number of arguments, expected at least %d, got %d", expectedMin, got)
}
diff --git a/services/device/device/local_install_test.go b/services/device/device/local_install_test.go
index b996393..5899c04 100644
--- a/services/device/device/local_install_test.go
+++ b/services/device/device/local_install_test.go
@@ -19,7 +19,7 @@
"v.io/v23/security"
"v.io/v23/services/application"
"v.io/v23/services/device"
- "v.io/x/lib/cmdline2"
+ "v.io/x/lib/cmdline"
"v.io/x/ref/lib/v23cmd"
"v.io/x/ref/test"
@@ -45,7 +45,7 @@
// Setup the command-line.
cmd := cmd_device.CmdRoot
var stdout, stderr bytes.Buffer
- env := &cmdline2.Env{Stdout: &stdout, Stderr: &stderr}
+ env := &cmdline.Env{Stdout: &stdout, Stderr: &stderr}
deviceName := naming.JoinAddressName(endpoint.String(), "")
const appTitle = "Appo di tutti Appi"
binary := os.Args[0]
diff --git a/services/device/device/publish.go b/services/device/device/publish.go
index ae49d3c..f2524b0 100644
--- a/services/device/device/publish.go
+++ b/services/device/device/publish.go
@@ -19,7 +19,7 @@
"v.io/v23/services/application"
"v.io/v23/services/permissions"
"v.io/v23/verror"
- "v.io/x/lib/cmdline2"
+ "v.io/x/lib/cmdline"
"v.io/x/ref/lib/v23cmd"
"v.io/x/ref/services/internal/binarylib"
"v.io/x/ref/services/repository"
@@ -29,7 +29,7 @@
// TODO(caprita): Extend to include env, args, packages.
-var cmdPublish = &cmdline2.Command{
+var cmdPublish = &cmdline.Command{
Runner: v23cmd.RunnerFunc(runPublish),
Name: "publish",
Short: "Publish the given application(s).",
@@ -56,7 +56,7 @@
cmdPublish.Flags.StringVar(&readBlessings, "readers", "dev.v.io", "If non-empty, comma-separated blessing patterns to add to Read and Resolve AccessList.")
}
-func setAccessLists(ctx *context.T, env *cmdline2.Env, von string) error {
+func setAccessLists(ctx *context.T, env *cmdline.Env, von string) error {
if readBlessings == "" {
return nil
}
@@ -81,7 +81,7 @@
return nil
}
-func publishOne(ctx *context.T, env *cmdline2.Env, binPath, binary string) error {
+func publishOne(ctx *context.T, env *cmdline.Env, binPath, binary string) error {
binaryName, title := binary, binary
if parts := strings.SplitN(binary, "@", 2); len(parts) == 2 {
binaryName, title = parts[0], parts[1]
@@ -138,7 +138,7 @@
return nil
}
-func runPublish(ctx *context.T, env *cmdline2.Env, args []string) error {
+func runPublish(ctx *context.T, env *cmdline.Env, args []string) error {
if expectedMin, got := 1, len(args); got < expectedMin {
return env.UsageErrorf("publish: incorrect number of arguments, expected at least %d, got %d", expectedMin, got)
}
diff --git a/services/device/device/root.go b/services/device/device/root.go
index 650838a..df28595 100644
--- a/services/device/device/root.go
+++ b/services/device/device/root.go
@@ -7,20 +7,20 @@
import (
"regexp"
- "v.io/x/lib/cmdline2"
+ "v.io/x/lib/cmdline"
_ "v.io/x/ref/runtime/factories/static"
)
-var CmdRoot = &cmdline2.Command{
+var CmdRoot = &cmdline.Command{
Name: "device",
Short: "facilitates interaction with the Vanadium device manager",
Long: `
Command device facilitates interaction with the Vanadium device manager.
`,
- Children: []*cmdline2.Command{cmdInstall, cmdInstallLocal, cmdUninstall, cmdAssociate, cmdDescribe, cmdClaim, cmdInstantiate, cmdDelete, cmdRun, cmdKill, cmdRevert, cmdUpdate, cmdUpdateAll, cmdStatus, cmdDebug, cmdACL, cmdPublish},
+ Children: []*cmdline.Command{cmdInstall, cmdInstallLocal, cmdUninstall, cmdAssociate, cmdDescribe, cmdClaim, cmdInstantiate, cmdDelete, cmdRun, cmdKill, cmdRevert, cmdUpdate, cmdUpdateAll, cmdStatus, cmdDebug, cmdACL, cmdPublish},
}
func main() {
- cmdline2.HideGlobalFlagsExcept(regexp.MustCompile(`^((v23\.namespace\.root)|(v23\.proxy))$`))
- cmdline2.Main(CmdRoot)
+ cmdline.HideGlobalFlagsExcept(regexp.MustCompile(`^((v23\.namespace\.root)|(v23\.proxy))$`))
+ cmdline.Main(CmdRoot)
}
diff --git a/services/device/device/updateall.go b/services/device/device/updateall.go
index b98b46b..e772ee9 100644
--- a/services/device/device/updateall.go
+++ b/services/device/device/updateall.go
@@ -15,7 +15,7 @@
"v.io/v23/naming"
"v.io/v23/services/device"
"v.io/v23/verror"
- "v.io/x/lib/cmdline2"
+ "v.io/x/lib/cmdline"
"v.io/x/ref/lib/v23cmd"
deviceimpl "v.io/x/ref/services/device/internal/impl"
)
@@ -25,7 +25,7 @@
// TODO(caprita): Add unit test.
-var cmdUpdateAll = &cmdline2.Command{
+var cmdUpdateAll = &cmdline.Command{
Runner: v23cmd.RunnerFunc(runUpdateAll),
Name: "updateall",
Short: "Update all installations/instances of an application",
@@ -44,9 +44,9 @@
`,
}
-type updater func(ctx *context.T, env *cmdline2.Env, von string) error
+type updater func(ctx *context.T, env *cmdline.Env, von string) error
-func updateChildren(ctx *context.T, env *cmdline2.Env, von string, updateChild updater) error {
+func updateChildren(ctx *context.T, env *cmdline.Env, von string, updateChild updater) error {
ns := v23.GetNamespace(ctx)
pattern := naming.Join(von, "*")
c, err := ns.Glob(ctx, pattern)
@@ -96,7 +96,7 @@
return s.Value.State == device.InstanceStateRunning, nil
}
-func updateInstance(ctx *context.T, env *cmdline2.Env, von string) (retErr error) {
+func updateInstance(ctx *context.T, env *cmdline.Env, von string) (retErr error) {
defer func() {
if retErr == nil {
fmt.Fprintf(env.Stdout, "Successfully updated instance %q.\n", von)
@@ -153,7 +153,7 @@
}
}
-func updateInstallation(ctx *context.T, env *cmdline2.Env, von string) (retErr error) {
+func updateInstallation(ctx *context.T, env *cmdline.Env, von string) (retErr error) {
defer func() {
if retErr == nil {
fmt.Fprintf(env.Stdout, "Successfully updated installation %q.\n", von)
@@ -179,7 +179,7 @@
return updateChildren(ctx, env, von, updateInstance)
}
-func updateApp(ctx *context.T, env *cmdline2.Env, von string) error {
+func updateApp(ctx *context.T, env *cmdline.Env, von string) error {
if err := updateChildren(ctx, env, von, updateInstallation); err != nil {
err = fmt.Errorf("failed to update app %q: %v", von, err)
fmt.Fprintf(env.Stderr, "ERROR: %v.\n", err)
@@ -189,7 +189,7 @@
return nil
}
-func updateAllApps(ctx *context.T, env *cmdline2.Env, von string) error {
+func updateAllApps(ctx *context.T, env *cmdline.Env, von string) error {
if err := updateChildren(ctx, env, von, updateApp); err != nil {
err = fmt.Errorf("failed to update all apps %q: %v", von, err)
fmt.Fprintf(env.Stderr, "ERROR: %v.\n", err)
@@ -199,7 +199,7 @@
return nil
}
-func runUpdateAll(ctx *context.T, env *cmdline2.Env, args []string) error {
+func runUpdateAll(ctx *context.T, env *cmdline.Env, args []string) error {
if expected, got := 1, len(args); expected != got {
return env.UsageErrorf("updateall: incorrect number of arguments, expected %d, got %d", expected, got)
}
diff --git a/services/device/deviced/commands.go b/services/device/deviced/commands.go
index a2eccc2..34d819e 100644
--- a/services/device/deviced/commands.go
+++ b/services/device/deviced/commands.go
@@ -8,7 +8,7 @@
"fmt"
"os"
- "v.io/x/lib/cmdline2"
+ "v.io/x/lib/cmdline"
"v.io/v23"
"v.io/x/lib/vlog"
@@ -41,8 +41,8 @@
}
}
-var cmdInstall = &cmdline2.Command{
- Runner: cmdline2.RunnerFunc(runInstall),
+var cmdInstall = &cmdline.Command{
+ Runner: cmdline.RunnerFunc(runInstall),
Name: "install",
Short: "Install the device manager.",
Long: fmt.Sprintf("Performs installation of device manager into %s (if the env var set), or into the current dir otherwise", deviceDirEnv),
@@ -63,7 +63,7 @@
cmdInstall.Flags.BoolVar(&initMode, "init_mode", false, "if set, installs the device manager with the system init service manager")
}
-func runInstall(env *cmdline2.Env, args []string) error {
+func runInstall(env *cmdline.Env, args []string) error {
if installFrom != "" {
// TODO(caprita): Also pass args into InstallFrom.
if err := impl.InstallFrom(installFrom); err != nil {
@@ -88,8 +88,8 @@
return nil
}
-var cmdUninstall = &cmdline2.Command{
- Runner: cmdline2.RunnerFunc(runUninstall),
+var cmdUninstall = &cmdline.Command{
+ Runner: cmdline.RunnerFunc(runUninstall),
Name: "uninstall",
Short: "Uninstall the device manager.",
Long: fmt.Sprintf("Removes the device manager installation from %s (if the env var set), or the current dir otherwise", deviceDirEnv),
@@ -99,7 +99,7 @@
cmdUninstall.Flags.StringVar(&suidHelper, "suid_helper", "", "path to suid helper")
}
-func runUninstall(env *cmdline2.Env, _ []string) error {
+func runUninstall(env *cmdline.Env, _ []string) error {
if suidHelper == "" {
return env.UsageErrorf("--suid_helper must be set")
}
@@ -110,14 +110,14 @@
return nil
}
-var cmdStart = &cmdline2.Command{
- Runner: cmdline2.RunnerFunc(runStart),
+var cmdStart = &cmdline.Command{
+ Runner: cmdline.RunnerFunc(runStart),
Name: "start",
Short: "Start the device manager.",
Long: fmt.Sprintf("Starts the device manager installed under from %s (if the env var set), or the current dir otherwise", deviceDirEnv),
}
-func runStart(env *cmdline2.Env, _ []string) error {
+func runStart(env *cmdline.Env, _ []string) error {
if err := impl.Start(installationDir(), env.Stderr, env.Stdout); err != nil {
vlog.Errorf("Start failed: %v", err)
return err
@@ -125,14 +125,14 @@
return nil
}
-var cmdStop = &cmdline2.Command{
- Runner: cmdline2.RunnerFunc(runStop),
+var cmdStop = &cmdline.Command{
+ Runner: cmdline.RunnerFunc(runStop),
Name: "stop",
Short: "Stop the device manager.",
Long: fmt.Sprintf("Stops the device manager installed under from %s (if the env var set), or the current dir otherwise", deviceDirEnv),
}
-func runStop(env *cmdline2.Env, _ []string) error {
+func runStop(env *cmdline.Env, _ []string) error {
ctx, shutdown := v23.Init()
defer shutdown()
if err := impl.Stop(ctx, installationDir(), env.Stderr, env.Stdout); err != nil {
@@ -142,14 +142,14 @@
return nil
}
-var cmdProfile = &cmdline2.Command{
- Runner: cmdline2.RunnerFunc(runProfile),
+var cmdProfile = &cmdline.Command{
+ Runner: cmdline.RunnerFunc(runProfile),
Name: "profile",
Short: "Dumps profile for the device manager.",
Long: "Prints the internal profile description for the device manager.",
}
-func runProfile(env *cmdline2.Env, _ []string) error {
+func runProfile(env *cmdline.Env, _ []string) error {
spec, err := impl.ComputeDeviceProfile()
if err != nil {
vlog.Errorf("ComputeDeviceProfile failed: %v", err)
diff --git a/services/device/deviced/main.go b/services/device/deviced/main.go
index 8da9320..59b6f37 100644
--- a/services/device/deviced/main.go
+++ b/services/device/deviced/main.go
@@ -11,7 +11,7 @@
"os"
"runtime"
- "v.io/x/lib/cmdline2"
+ "v.io/x/lib/cmdline"
"v.io/x/ref/lib/v23cmd"
)
@@ -22,15 +22,15 @@
runtime.GOMAXPROCS(runtime.NumCPU())
}
- rootCmd := &cmdline2.Command{
+ rootCmd := &cmdline.Command{
Name: "deviced",
Short: "launch, configure and manage the deviced daemon",
Long: `
Command deviced is used to launch, configure and manage the deviced daemon,
which implements the v.io/v23/services/device interfaces.
`,
- Children: []*cmdline2.Command{cmdInstall, cmdUninstall, cmdStart, cmdStop, cmdProfile},
+ Children: []*cmdline.Command{cmdInstall, cmdUninstall, cmdStart, cmdStop, cmdProfile},
Runner: v23cmd.RunnerFunc(runServer),
}
- cmdline2.Main(rootCmd)
+ cmdline.Main(rootCmd)
}
diff --git a/services/device/deviced/server.go b/services/device/deviced/server.go
index 0f22aa3..8858fb4 100644
--- a/services/device/deviced/server.go
+++ b/services/device/deviced/server.go
@@ -19,7 +19,7 @@
"v.io/v23/context"
"v.io/v23/rpc"
"v.io/v23/verror"
- "v.io/x/lib/cmdline2"
+ "v.io/x/lib/cmdline"
"v.io/x/lib/vlog"
vexec "v.io/x/ref/lib/exec"
"v.io/x/ref/lib/mgmt"
@@ -47,10 +47,10 @@
)
func init() {
- cmdline2.HideGlobalFlagsExcept(regexp.MustCompile(`^((name)|(restart-exit-code)|(neighborhood-name)|(deviced-port)|(proxy-port)|(use-pairing-token))$`))
+ cmdline.HideGlobalFlagsExcept(regexp.MustCompile(`^((name)|(restart-exit-code)|(neighborhood-name)|(deviced-port)|(proxy-port)|(use-pairing-token))$`))
}
-func runServer(ctx *context.T, _ *cmdline2.Env, _ []string) error {
+func runServer(ctx *context.T, _ *cmdline.Env, _ []string) error {
var testMode bool
// If this device manager was started by another device manager, it must
// be part of a self update to test that this binary works. In that
@@ -101,7 +101,7 @@
dev := starter.DeviceArgs{
ConfigState: configState,
TestMode: testMode,
- RestartCallback: func() { exitErr = cmdline2.ErrExitCode(*restartExitCode) },
+ RestartCallback: func() { exitErr = cmdline.ErrExitCode(*restartExitCode) },
PairingToken: pairingToken,
}
if testMode {
diff --git a/services/profile/profile/impl.go b/services/profile/profile/impl.go
index 489f0e2..ea27f27 100644
--- a/services/profile/profile/impl.go
+++ b/services/profile/profile/impl.go
@@ -13,7 +13,7 @@
"v.io/v23/context"
"v.io/v23/services/build"
- "v.io/x/lib/cmdline2"
+ "v.io/x/lib/cmdline"
"v.io/x/ref/lib/v23cmd"
_ "v.io/x/ref/runtime/factories/generic"
"v.io/x/ref/services/profile"
@@ -21,14 +21,14 @@
)
func main() {
- cmdline2.Main(cmdRoot)
+ cmdline.Main(cmdRoot)
}
func init() {
- cmdline2.HideGlobalFlagsExcept()
+ cmdline.HideGlobalFlagsExcept()
}
-var cmdLabel = &cmdline2.Command{
+var cmdLabel = &cmdline.Command{
Runner: v23cmd.RunnerFunc(runLabel),
Name: "label",
Short: "Shows a human-readable profile key for the profile.",
@@ -37,7 +37,7 @@
ArgsLong: "<profile> is the full name of the profile.",
}
-func runLabel(ctx *context.T, env *cmdline2.Env, args []string) error {
+func runLabel(ctx *context.T, env *cmdline.Env, args []string) error {
if expected, got := 1, len(args); expected != got {
return env.UsageErrorf("label: incorrect number of arguments, expected %d, got %d", expected, got)
}
@@ -53,7 +53,7 @@
return nil
}
-var cmdDescription = &cmdline2.Command{
+var cmdDescription = &cmdline.Command{
Runner: v23cmd.RunnerFunc(runDescription),
Name: "description",
Short: "Shows a human-readable profile description for the profile.",
@@ -62,7 +62,7 @@
ArgsLong: "<profile> is the full name of the profile.",
}
-func runDescription(ctx *context.T, env *cmdline2.Env, args []string) error {
+func runDescription(ctx *context.T, env *cmdline.Env, args []string) error {
if expected, got := 1, len(args); expected != got {
return env.UsageErrorf("description: incorrect number of arguments, expected %d, got %d", expected, got)
}
@@ -78,7 +78,7 @@
return nil
}
-var cmdSpecification = &cmdline2.Command{
+var cmdSpecification = &cmdline.Command{
Runner: v23cmd.RunnerFunc(runSpecification),
Name: "specification",
Short: "Shows the specification of the profile.",
@@ -87,7 +87,7 @@
ArgsLong: "<profile> is the full name of the profile.",
}
-func runSpecification(ctx *context.T, env *cmdline2.Env, args []string) error {
+func runSpecification(ctx *context.T, env *cmdline.Env, args []string) error {
if expected, got := 1, len(args); expected != got {
return env.UsageErrorf("specification: incorrect number of arguments, expected %d, got %d", expected, got)
}
@@ -103,7 +103,7 @@
return nil
}
-var cmdPut = &cmdline2.Command{
+var cmdPut = &cmdline.Command{
Runner: v23cmd.RunnerFunc(runPut),
Name: "put",
Short: "Sets a placeholder specification for the profile.",
@@ -112,7 +112,7 @@
ArgsLong: "<profile> is the full name of the profile.",
}
-func runPut(ctx *context.T, env *cmdline2.Env, args []string) error {
+func runPut(ctx *context.T, env *cmdline.Env, args []string) error {
if expected, got := 1, len(args); expected != got {
return env.UsageErrorf("put: incorrect number of arguments, expected %d, got %d", expected, got)
}
@@ -137,7 +137,7 @@
return nil
}
-var cmdRemove = &cmdline2.Command{
+var cmdRemove = &cmdline.Command{
Runner: v23cmd.RunnerFunc(runRemove),
Name: "remove",
Short: "removes the profile specification for the profile.",
@@ -146,7 +146,7 @@
ArgsLong: "<profile> is the full name of the profile.",
}
-func runRemove(ctx *context.T, env *cmdline2.Env, args []string) error {
+func runRemove(ctx *context.T, env *cmdline.Env, args []string) error {
if expected, got := 1, len(args); expected != got {
return env.UsageErrorf("remove: incorrect number of arguments, expected %d, got %d", expected, got)
}
@@ -161,11 +161,11 @@
return nil
}
-var cmdRoot = &cmdline2.Command{
+var cmdRoot = &cmdline.Command{
Name: "profile",
Short: "manages the Vanadium profile repository",
Long: `
Command profile manages the Vanadium profile repository.
`,
- Children: []*cmdline2.Command{cmdLabel, cmdDescription, cmdSpecification, cmdPut, cmdRemove},
+ Children: []*cmdline.Command{cmdLabel, cmdDescription, cmdSpecification, cmdPut, cmdRemove},
}
diff --git a/services/profile/profile/impl_test.go b/services/profile/profile/impl_test.go
index 4227e5b..2c4e135 100644
--- a/services/profile/profile/impl_test.go
+++ b/services/profile/profile/impl_test.go
@@ -17,7 +17,7 @@
"v.io/v23/security"
"v.io/v23/services/build"
- "v.io/x/lib/cmdline2"
+ "v.io/x/lib/cmdline"
"v.io/x/lib/vlog"
"v.io/x/ref/lib/v23cmd"
_ "v.io/x/ref/runtime/factories/generic"
@@ -127,7 +127,7 @@
defer stopServer(t, server)
// Setup the command-line.
var stdout, stderr bytes.Buffer
- env := &cmdline2.Env{Stdout: &stdout, Stderr: &stderr}
+ env := &cmdline.Env{Stdout: &stdout, Stderr: &stderr}
exists := naming.JoinAddressName(endpoint.String(), "exists")
// Test the 'label' command.