選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
 
 
 

32 行
784 B

  1. // Copyright 2017 The Go Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. package main
  5. import (
  6. "golang.org/x/text/message/pipeline"
  7. )
  8. func init() {
  9. out = cmdGenerate.Flag.String("out", "", "output file to write to")
  10. }
  11. var cmdGenerate = &Command{
  12. Run: runGenerate,
  13. UsageLine: "generate <package>",
  14. Short: "generates code to insert translated messages",
  15. }
  16. func runGenerate(cmd *Command, config *pipeline.Config, args []string) error {
  17. config.Packages = args
  18. s, err := pipeline.Extract(config)
  19. if err != nil {
  20. return wrap(err, "extraction failed")
  21. }
  22. if err := s.Import(); err != nil {
  23. return wrap(err, "import failed")
  24. }
  25. return wrap(s.Generate(), "generation failed")
  26. }