go.chromium.org/luci@v0.0.0-20240309015107-7cdc2e660f33/client/flagpb/doc.go (about) 1 // Copyright 2016 The LUCI Authors. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 // Package flagpb defines a flag format for protobuf messages, 16 // implements a parser and a formatter. 17 // 18 // Currently flagpb supports only untyped messages, not proto.Message. 19 // Support for the latter could be added too. 20 // 21 // # Syntax 22 // 23 // Flag syntax by example. First line is flagpb, second is jsonpb. 24 // 25 // -x=42 -b -s hello 26 // {"x": 42, "b": true, "s": "hello"} 27 // 28 // -m.x 3 -m.s world 29 // {"m": {"x": 3, "s": "world"}} 30 // 31 // -rx 1 -rx 2 32 // {"rx": [1, 2]} 33 // 34 // -rm.x 1 -rm -rm.x 2 35 // {"rm": [{"x": 1}, {"x": 2}]} 36 // 37 // where x fields are int32, m are message fields, b are boolean and 38 // s are strings. Fields with "r" prefix are repeated. 39 // 40 // Bytes field values are decoded from hex, e.g. "FF02AB". 41 // 42 // Enum field values can be specified by enum member name or number. 43 package flagpb