github.com/attic-labs/noms@v0.0.0-20210827224422-e5fa29d95e8b/samples/cli/nomsconfig/README.md (about) 1 # nomsconfig 2 3 The noms cli now provides experimental support for configuring a convenient default database and database aliases. 4 5 You can enable this support by placing a *.nomsconfig* config file (like the [one](.nomsconfig) in this sample) in the directory where you'd like to use the configuration. Like git, any noms command issued from that directory or below will use it. 6 7 # Features 8 9 - *Database Aliases* - Define simple names to be used in place of database URLs 10 - *Default Database* - Define one database to be used by default when no database in mentioned 11 - *Dot (`.`) Shorthand* - Use `.` instead of repeating dataset/object name in destination 12 13 # Example 14 15 This example defines a simple [.nomsconfig](.nomsconfig) to try: 16 17 ```shell 18 # Default database URL to be used whenever a database is not explictly provided 19 [db.default] 20 url = "ldb:.noms/tour" 21 22 # DB alias named `origin` that refers to the remote cli-tour db 23 [db.origin] 24 url = "http://demo.noms.io/cli-tour" 25 26 # DB alias named `temp` that refers to a noms db stored under /tmp 27 [db.temp] 28 url = "ldb:/tmp/noms/shared 29 30 ``` 31 32 The *[db.default]* section: 33 34 - Defines a default database 35 - It will be used implicitly whenever a database url is omitted in a command 36 37 The *[db.origin]* and *[db.shared]* sections: 38 39 - Define aliases that can be used wherever a db url is required 40 - You can define additional aliases by adding *[db.**alias**]* sections using any **alias** you prefer 41 42 Dot (`.`) shorthand: 43 44 - When issuing a command that requires a source and destination (like `noms sync`), 45 you can use `.` in place of the dataset/object in the destination. This is shorthand 46 that repeats whatever was used in the source (see below). 47 48 49 You can kick the tires by running noms commands from this directory. Here are some examples and what to expect: 50 51 ```shell 52 noms ds # -> noms ds ldb:.noms/tour 53 noms ds default # -> noms ds ldb:.noms/tour 54 noms ds origin # -> noms ds http://demo.noms.io/cli-tour 55 56 noms sync origin::sf-film-locations sf-films # sync ds from origin to default 57 58 noms log sf-films # -> noms log ldb:.noms/tour::sf-films 59 noms log origin::sf-film-locations # -> noms log http://demo.noms.io/cli-tour::sf-film-locations 60 61 noms show '#1a2aj8svslsu7g8hplsva6oq6iq3ib6c' # -> noms show ldb:.noms/tour::'#1a2a...' 62 noms show origin::'#1a2aj8svslsu7g8hplsva6oq6iq3ib6c' # -> noms show http://demo.noms.io/cli-tour::'#1a2a...' 63 64 noms diff '#1a2aj8svslsu7g8hplsva6oq6iq3ib6c' origin::. # diff default::object with origin::object 65 66 noms sync origin::sf-bike-parking . # sync origin::sf-bike-parking to default::sf-bike-parking 67 68 ``` 69 70 A few more things to note: 71 72 - Relative paths will be expanded relative to the directory where the *.nomsconfg* is defined 73 - Use `noms config` to see the current alias definitions with expanded paths 74 - Use `-v` or `--verbose` on any command to see how the command arguments are being resolved 75 - Explicit DB urls are still fully supported