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