code.vegaprotocol.io/vega@v0.79.0/cmd/vega/commands/paths/paths.go (about) 1 // Copyright (C) 2023 Gobalsky Labs Limited 2 // 3 // This program is free software: you can redistribute it and/or modify 4 // it under the terms of the GNU Affero General Public License as 5 // published by the Free Software Foundation, either version 3 of the 6 // License, or (at your option) any later version. 7 // 8 // This program is distributed in the hope that it will be useful, 9 // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 // GNU Affero General Public License for more details. 12 // 13 // You should have received a copy of the GNU Affero General Public License 14 // along with this program. If not, see <http://www.gnu.org/licenses/>. 15 16 package paths 17 18 import ( 19 "context" 20 21 "github.com/jessevdk/go-flags" 22 ) 23 24 type Cmd struct { 25 List ListCmd `command:"list" description:"List the location where files used by the Vega applications are stored"` 26 Explain ExplainCmd `command:"explain" description:"Explain what a path is about"` 27 } 28 29 var pathsCmd Cmd 30 31 func Paths(ctx context.Context, parser *flags.Parser) error { 32 pathsCmd = Cmd{ 33 List: ListCmd{}, 34 Explain: ExplainCmd{}, 35 } 36 37 var ( 38 short = "Manages the Vega paths" 39 long = ` 40 Vega applications store their configuration and their data at specific locations. 41 By default, it uses the XDG Base Directory specification, but can be customised 42 using the --home flag. 43 44 The XDG Base Directory specification defines where these files should be looked 45 for by defining several base directories relative to which files should be 46 located. The location of these directories is specific to each platform. 47 48 Role | Linux | MacOS | Windows 49 -------| ---------------|-------------------------------|--------------------- 50 cache | ~/.cache | ~/Library/Caches | %LOCALAPPDATA%\cache 51 config | ~/.config | ~/Library/Application Support | %LOCALAPPDATA% 52 data | ~/.local/share | ~/Library/Application Support | %LOCALAPPDATA% 53 state | ~/.local/state | ~/Library/Application Support | %LOCALAPPDATA% 54 55 Vega applications also support setting a custom location for these files using 56 the --home flag. Contrary to the XDG Base Directory specification, this flag 57 will group the cache, config, data and state folders under a "vega" folder, at 58 the specified location.` 59 ) 60 61 _, err := parser.AddCommand("paths", short, long, &pathsCmd) 62 63 return err 64 }