Implement yaml format
This commit is contained in:
76
README.md
76
README.md
@@ -4,27 +4,81 @@ A small Go tool for creating symbolic links
|
||||
|
||||
Created out of infuriating difficulty of creating symbolic links on windows
|
||||
|
||||
## Custom syntax
|
||||
## Instruction Formats
|
||||
|
||||
The tool works with "instructions" that describe symbolic links
|
||||
The tool supports two formats for defining symbolic links:
|
||||
|
||||
They are, in any form, \<source>,\<destination>,\<force?>
|
||||
### 1. CSV Format (Legacy)
|
||||
|
||||
Simple comma-separated values with the format: `<source>,<destination>[,force][,hard][,delete]`
|
||||
|
||||
For example:
|
||||
`sync this,that`
|
||||
```
|
||||
source_path,target_path
|
||||
source_path,target_path,true
|
||||
source_path,target_path,true,true
|
||||
source_path,target_path,true,true,true
|
||||
```
|
||||
|
||||
It supports input of these instructions through:
|
||||
Or with named flags:
|
||||
```
|
||||
source_path,target_path,force=true,hard=true,delete=true
|
||||
source_path,target_path,f=true,h=true,d=true
|
||||
```
|
||||
|
||||
### 2. YAML Format (Recommended)
|
||||
|
||||
A more readable format using YAML:
|
||||
|
||||
```yaml
|
||||
links:
|
||||
- source: ~/Documents/config.ini
|
||||
target: ~/.config/app/config.ini
|
||||
force: true
|
||||
|
||||
- source: ~/Pictures
|
||||
target: ~/Documents/Pictures
|
||||
hard: true
|
||||
force: true
|
||||
|
||||
- source: ~/Scripts/script.sh
|
||||
target: ~/bin/script.sh
|
||||
delete: true
|
||||
```
|
||||
|
||||
Alternatively, you can use an array directly:
|
||||
|
||||
```yaml
|
||||
- source: ~/Documents/config.ini
|
||||
target: ~/.config/app/config.ini
|
||||
force: true
|
||||
|
||||
- source: ~/Pictures
|
||||
target: ~/Documents/Pictures
|
||||
hard: true
|
||||
```
|
||||
|
||||
## Input Methods
|
||||
|
||||
The tool supports input of these instructions through:
|
||||
|
||||
- Stdin
|
||||
- `echo "this,that" | sync`
|
||||
- `echo "this,that" | sync`
|
||||
- Run arguments
|
||||
- `sync this,that foo,bar "foo 2","C:/bar"`
|
||||
- `sync this,that foo,bar "foo 2","C:/bar"`
|
||||
- Files
|
||||
- `sync -f <file>`
|
||||
- Where the file contains instructions, one instruction per line
|
||||
- `sync -f <file>` (CSV format)
|
||||
- `sync -f <file.yaml>` or `sync -f <file.yml>` (YAML format)
|
||||
- Where the file contains instructions, one per line for CSV or structured YAML
|
||||
- Directories
|
||||
- `sync -r <directory>`
|
||||
- This mode will look for "sync" files recursively in directories and run their instructions
|
||||
- `sync -r <directory>`
|
||||
- This mode will look for "sync", "sync.yaml", or "sync.yml" files recursively in directories and run their instructions
|
||||
|
||||
## Options
|
||||
|
||||
- `force: true` - Overwrite an existing symbolic link at the target location
|
||||
- `hard: true` - Create a hard link instead of a symbolic link
|
||||
- `delete: true` - Delete a non-symlink file at the target location (implies `force: true`)
|
||||
|
||||
## Use case
|
||||
|
||||
|
Reference in New Issue
Block a user