mirror of
https://github.com/tailscale/tailscale.git
synced 2026-11-28 12:36:26 -08:00
Flatten the cmd/tailscale package hierarchy by extracting the jsonoutput package out of the cmd/tailscale/cli package. Updates #cleanup Change-Id: I92f80db75b0328e82f1596b6a42f6f6ef5a94bfa Signed-off-by: Simon Law <[email protected]>
26 lines
531 B
Go
26 lines
531 B
Go
// Copyright (c) Tailscale Inc & contributors
|
|
// SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
package jsonoutput_test
|
|
|
|
import (
|
|
"flag"
|
|
"fmt"
|
|
|
|
"tailscale.com/cmd/tailscale/jsonoutput"
|
|
)
|
|
|
|
var args struct {
|
|
json jsonoutput.SchemaVersion
|
|
}
|
|
|
|
func ExampleSchemaVersion() {
|
|
fs := flag.NewFlagSet("ExampleSchemaVersion", flag.ExitOnError)
|
|
fs.Var(&args.json, "json", "output in JSON format")
|
|
|
|
fs.Parse([]string{"-json=2"})
|
|
fmt.Printf(`{set: %t, version: %d}`, args.json.IsSet, args.json.Version)
|
|
// Output:
|
|
// {set: true, version: 2}
|
|
}
|