format_doc.go 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. package all
  2. import (
  3. "github.com/v2fly/v2ray-core/v4/commands/base"
  4. )
  5. var docFormat = &base.Command{
  6. UsageLine: "{{.Exec}} format-loader",
  7. Short: "config formats and loading",
  8. Long: `
  9. {{.Exec}} supports different config formats:
  10. * json (.json, .jsonc)
  11. The default loader, multiple config files support.
  12. * yaml (.yml)
  13. The yaml loader, multiple config files support.
  14. * protobuf / pb (.pb)
  15. Single conifg file support. If multiple files assigned,
  16. only the first one is loaded.
  17. If "-format" is not explicitly specified, {{.Exec}} will choose
  18. a loader by detecting the extension of the first config file, or
  19. use the default loader.
  20. The following explains how format loaders behave with examples.
  21. Examples:
  22. {{.Exec}} run -d dir (1)
  23. {{.Exec}} run -format=protobuf -d dir (2)
  24. {{.Exec}} test -c c1.yml -d dir (3)
  25. {{.Exec}} test -format=pb -c c1.json (4)
  26. (1) The default json loader is used, {{.Exec}} will try to load all
  27. json files in the "dir".
  28. (2) The protobuf loader is specified, {{.Exec}} will try to find
  29. all protobuf files in the "dir", but only the the first
  30. .pb file is loaded.
  31. (3) The yaml loader is selected because of the "c1.yml" file,
  32. {{.Exec}} will try to load "c1.yml" and all yaml files in
  33. the "dir".
  34. (4) The protobuf loader is specified, {{.Exec}} will load
  35. "c1.json" as protobuf, no matter its extension.
  36. `,
  37. }