| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // cli.go implements logic to create a generator config object from command | 5 // cli.go implements logic to create a generator config object from command |
| 6 // line arguments. | 6 // line arguments. |
| 7 | 7 |
| 8 package common | 8 package common |
| 9 | 9 |
| 10 import ( | 10 import ( |
| 11 "flag" | 11 "flag" |
| 12 "io" | 12 "io" |
| 13 "io/ioutil" | 13 "io/ioutil" |
| 14 "log" | 14 "log" |
| 15 "os" | 15 "os" |
| 16 "path/filepath" | 16 "path/filepath" |
| 17 | 17 |
| 18 "mojo/public/go/bindings" | 18 "mojo/public/go/bindings" |
| 19 » "mojom/mojom_tool/generated/mojom_files" | 19 » "mojom/generated/mojom_files" |
| 20 ) | 20 ) |
| 21 | 21 |
| 22 // GetConfig provides the primary interface for generators. | 22 // GetConfig provides the primary interface for generators. |
| 23 // By calling GetConfig, a generator implements the command line interface | 23 // By calling GetConfig, a generator implements the command line interface |
| 24 // that is used by all generators. | 24 // that is used by all generators. |
| 25 func GetCliConfig(args []string) GeneratorConfig { | 25 func GetCliConfig(args []string) GeneratorConfig { |
| 26 config := new(generatorCliConfig) | 26 config := new(generatorCliConfig) |
| 27 flagSet := flag.NewFlagSet("Generator Common Flag Set", flag.ExitOnError
) | 27 flagSet := flag.NewFlagSet("Generator Common Flag Set", flag.ExitOnError
) |
| 28 | 28 |
| 29 var fileGraphFile string | 29 var fileGraphFile string |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 | 102 |
| 103 // See GeneratorConfig. | 103 // See GeneratorConfig. |
| 104 func (c *generatorCliConfig) SrcRootPath() string { | 104 func (c *generatorCliConfig) SrcRootPath() string { |
| 105 return c.srcRootPath | 105 return c.srcRootPath |
| 106 } | 106 } |
| 107 | 107 |
| 108 // See GeneratorConfig. | 108 // See GeneratorConfig. |
| 109 func (c *generatorCliConfig) GenImports() bool { | 109 func (c *generatorCliConfig) GenImports() bool { |
| 110 return !c.noGenImports | 110 return !c.noGenImports |
| 111 } | 111 } |
| OLD | NEW |