recutils #2
							
								
								
									
										47
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										47
									
								
								README.md
									
									
									
									
									
								
							@@ -27,41 +27,54 @@ Try these commands:
 | 
			
		||||
 | 
			
		||||
Ask what types of _rec_ords it contains:
 | 
			
		||||
 | 
			
		||||
## Database
 | 
			
		||||
 | 
			
		||||
```sh
 | 
			
		||||
recinf network.rec
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Select with `recsel`, then specify the type of record.
 | 
			
		||||
### Select queries
 | 
			
		||||
 | 
			
		||||
Select with `recsel`, then specify the database (.rec) and type of record (like table in db).
 | 
			
		||||
 | 
			
		||||
`--include-descriptors` or `-d`
 | 
			
		||||
`--type` or `-t`
 | 
			
		||||
`--expression` or `-e`
 | 
			
		||||
`--quick` or `-q`
 | 
			
		||||
 | 
			
		||||
```sh
 | 
			
		||||
recsel network.rec --type router
 | 
			
		||||
recsel network.rec --include-descriptors --type lxc
 | 
			
		||||
recsel network.rec -d -t lxc
 | 
			
		||||
recsel network.rec -d -t lxc --expression
 | 
			
		||||
recsel network.rec -d -t lxc -e ?example?
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
User `-q` for a 'quick' selection, or `-e` for more precise selections.
 | 
			
		||||
User `-q` for a `--quick` selection, or `-e` for more precise selections.
 | 
			
		||||
 | 
			
		||||
```sh
 | 
			
		||||
recsel network.rec --type lxc --quick wiki
 | 
			
		||||
recsel network.rec --type lxc -q nginx
 | 
			
		||||
recsel network.rec -t lxc --expression "name ~ 'nginx'"
 | 
			
		||||
recsel network.rec -t lxc --expression "name = 'nginx12'"
 | 
			
		||||
recsel network.rec -t lxc -q nginx
 | 
			
		||||
recsel network.rec -t lxc -e "name ~ 'nginx'"
 | 
			
		||||
recsel network.rec -t lxc -e "name = 'nginx12'"
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
If you can select something, you can also set its fields with `recset`.
 | 
			
		||||
 | 
			
		||||
Use `-f` to set the field, and `-a` to add, or `-s` to set.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
```sh
 | 
			
		||||
recset network.rec -t lxc --expression "name = 'nginx12'" -f proxies --add soft-serve
 | 
			
		||||
recsel network.rec -t lxc --expression "name = 'nginx11'" -p proxies[0]
 | 
			
		||||
recset network.rec -t lxc --expression "name = 'nginx11'" -f proxies[0] -s wiki9
 | 
			
		||||
```
 | 
			
		||||
### Insert queries
 | 
			
		||||
 | 
			
		||||
Insert a new record with `recins`.
 | 
			
		||||
 | 
			
		||||
```sh
 | 
			
		||||
recins network.rec -t lxc -r "name: bob" -r "service: bob" -r "host: moxx"
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
### Update queries
 | 
			
		||||
 | 
			
		||||
If you can select something, you can also set its fields with `recset`.
 | 
			
		||||
 | 
			
		||||
Use `-f` to set the `--field`, and `-a` to `--add`, or `-s` to `--set`.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
```sh
 | 
			
		||||
recset network.rec -t lxc -e "name = 'nginx12'" -f proxies -a soft-serve
 | 
			
		||||
recsel network.rec -t lxc -e "name = 'nginx11'" -p proxies[0]
 | 
			
		||||
recset network.rec -t lxc -e" name = 'nginx11'" -f proxies[0] -s wiki9
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user