format_doc.go 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. package all
  2. import (
  3. "github.com/v2fly/v2ray-core/v4/main/commands/base"
  4. )
  5. var docFormat = &base.Command{
  6. UsageLine: "{{.Exec}} format-loader",
  7. Short: "config formats and loading",
  8. Long: `
  9. {{.Exec}} is equipped with multiple loaders to support different
  10. config formats:
  11. * auto
  12. The default loader, supports all formats listed below, with
  13. format detecting, and mixed fomats support.
  14. * json (.json, .jsonc)
  15. The json loader, multiple files support, mergeable.
  16. * toml (.toml)
  17. The toml loader, multiple files support, mergeable.
  18. * yaml (.yml, .yaml)
  19. The yaml loader, multiple files support, mergeable.
  20. * protobuf / pb (.pb)
  21. Single file support, unmergeable.
  22. The following explains how format loaders behaves.
  23. Examples:
  24. {{.Exec}} run -d dir (1)
  25. {{.Exec}} run -c c1.json -c c2.yaml (2)
  26. {{.Exec}} run -format=json -d dir (3)
  27. {{.Exec}} test -c c1.yml -c c2.pb (4)
  28. {{.Exec}} test -format=pb -d dir (5)
  29. {{.Exec}} test -format=protobuf -c c1.json (6)
  30. (1) Load all supported files in the "dir".
  31. (2) JSON and YAML are merged and loaded.
  32. (3) Load all JSON files in the "dir".
  33. (4) Goes error since .pb is not mergeable to others
  34. (5) Works only when single .pb file found, if not, failed due to
  35. unmergeable.
  36. (6) Force load "c1.json" as protobuf, no matter its extension.
  37. `,
  38. }