Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(103)

Side by Side Diff: common/flag/stringsetflag/stringsetflag_test.go

Issue 1622553005: Remove log filtering and add stringsetflag. (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/luci-go@master
Patch Set: error on empty Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « common/flag/stringsetflag/stringsetflag.go ('k') | common/logging/cloudlog/logging.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 package stringsetflag
6
7 import (
8 "flag"
9 "fmt"
10 "os"
11 )
12
13 // Example demonstrates how to use flagenum to create bindings for a custom
14 // type.
15 func Example() {
16 sset := Flag{}
17
18 fs := flag.NewFlagSet("test", flag.ContinueOnError)
19 fs.Var(&sset, "color", "favorite color, may be repeated.")
20 fs.SetOutput(os.Stdout)
21
22 fs.PrintDefaults()
23
24 // Flag parsing.
25 fs.Parse([]string{"-color", "Violet", "-color", "Red", "-color", "Violet "})
26 fmt.Printf("Value is: %s\n", sset)
27
28 fmt.Println("Likes Blue:", sset.Data.Has("Blue"))
29 fmt.Println("Likes Red:", sset.Data.Has("Red"))
30
31 // Output:
32 // -color=: favorite color, may be repeated.
33 // Value is: Red,Violet
34 // Likes Blue: false
35 // Likes Red: true
36 }
OLDNEW
« no previous file with comments | « common/flag/stringsetflag/stringsetflag.go ('k') | common/logging/cloudlog/logging.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698