Repository navigation
Expand file tree
/
Copy pathcli.html
More file actions
693 lines (684 loc) · 51.5 KB
/
Copy pathcli.html
File metadata and controls
693 lines (684 loc) · 51.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; style-src 'self'; img-src 'self'; base-uri 'none'; form-action 'none'">
<meta name="description" content="Every sync-servers command and option, the terminal interface and its keys, editor mode, plain mode, shell integration, exit codes and JSON output.">
<title>Command line | cmd-sync-servers</title>
<link rel="stylesheet" href="assets/site.css">
</head>
<body>
<a class="skip" href="#main">Skip to the content</a>
<header class="site-header">
<div class="inner">
<a class="brand" href="index.html">cmd-sync-servers</a>
<nav aria-label="Pages">
<ul>
<li><a href="index.html">Home</a></li>
<li><a href="quickstart.html">Quickstart</a></li>
<li><a href="getting-started.html">Getting started</a></li>
<li><a href="examples.html">Examples</a></li>
<li><a href="cheatsheets.html">Cheatsheets</a></li>
<li><a href="configuration.html">Configuration</a></li>
<li><a href="cli.html" aria-current="page">Command line</a></li>
<li><a href="options.html">Options</a></li>
<li><a href="synchronization.html">Synchronization</a></li>
<li><a href="api.html">Library API</a></li>
<li><a href="security.html">Security</a></li>
<li><a href="troubleshooting.html">Troubleshooting</a></li>
</ul>
</nav>
</div>
</header>
<main id="main">
<h1>Command line</h1>
<p class="lead">The program is <code>sync-servers</code>. With no command in a terminal it opens the full-screen interface; every task is also a command, for scripts and for anyone who prefers typing.</p>
<ul>
<li><a href="#commands">Commands</a></li>
<li><a href="#preview-modes">Preview modes</a></li>
<li><a href="#tui">The terminal interface</a></li>
<li><a href="#editor-mode">Editor mode</a></li>
<li><a href="#plain-mode">Plain mode</a></li>
<li><a href="#unattended">Unattended runs</a></li>
<li><a href="#shell-integration">Shell integration</a></li>
<li><a href="#exit-codes">Exit codes</a></li>
<li><a href="#json">JSON output</a></li>
</ul>
<h2 id="commands">Commands</h2>
<p>This reference is generated from the same definitions as <code>sync-servers --help</code>; <code>sync-servers <command> --help</code> prints the part for one command. A command acts on the site of the current folder unless it is given <code>--site</code>; see <a href="configuration.html#which-site">Which site a command means</a>.</p>
<!-- generated by npm run docs:cli from src/cli; edit the commands, not this section -->
<ul class="command-index">
<li><a href="#command-sites"><code>sites</code></a>: List the sites</li>
<li><a href="#command-site-add"><code>site add</code></a>: Add a site and its first server; in a terminal, connect first and pick the root from the server</li>
<li><a href="#command-site-edit"><code>site edit</code></a>: Change a site, with options or as JSON in your editor</li>
<li><a href="#command-site-show"><code>site show</code></a>: Show a site and its servers</li>
<li><a href="#command-site-remove"><code>site remove</code></a>: Remove a site, its saved passwords and its sync records</li>
<li><a href="#command-site-path"><code>site path</code></a>: Print a site's local root (with shell integration, change to it)</li>
<li><a href="#command-server-list"><code>server list</code></a>: List a site's servers</li>
<li><a href="#command-server-add"><code>server add</code></a>: Add a server to a site; in a terminal, connect first and pick the root from the server</li>
<li><a href="#command-server-edit"><code>server edit</code></a>: Change a server: asks again in a terminal, or takes options, or JSON in your editor</li>
<li><a href="#command-server-remove"><code>server remove</code></a>: Remove a server, its saved passwords and its sync records</li>
<li><a href="#command-server-test"><code>server test</code></a>: Connect, sign in, check the remote root and show what the server offers; in a terminal, fix what it finds</li>
<li><a href="#command-server-set-remote"><code>server set-remote</code></a>: Make a server the one synchronization uses</li>
<li><a href="#command-server-set-testing"><code>server set-testing</code></a>: Make a server the Testing server, or clear the role</li>
<li><a href="#command-password-set"><code>password set</code></a>: Save a password or key passphrase in the OS credential store</li>
<li><a href="#command-password-forget"><code>password forget</code></a>: Remove a saved password or key passphrase</li>
<li><a href="#command-cloak"><code>cloak</code></a>: Cloak files and folders so no operation touches them, in one site or every site, or list what is cloaked</li>
<li><a href="#command-uncloak"><code>uncloak</code></a>: Remove cloaked paths or patterns, from one site or from the global patterns</li>
<li><a href="#command-sync"><code>sync</code></a>: Synchronize a site with its Remote server: preview, then transfer</li>
<li><a href="#command-put"><code>put</code></a>: Put files or folders now, with a preview only when a decision is needed</li>
<li><a href="#command-get"><code>get</code></a>: Get files or folders now, with a preview only when a decision is needed</li>
<li><a href="#command-status"><code>status</code></a>: Show what changed on each side since the last sync; transfers nothing</li>
<li><a href="#command-diff"><code>diff</code></a>: Show how the local and remote copies of a file differ</li>
<li><a href="#command-mark-synced"><code>mark-synced</code></a>: Record files as in sync without transferring them</li>
<li><a href="#command-state-reset"><code>state reset</code></a>: Forget the sync records of a site and server; the next sync starts from scratch</li>
<li><a href="#command-config-path"><code>config path</code></a>: Show the folders sync-servers reads and writes</li>
<li><a href="#command-config-edit"><code>config edit</code></a>: Edit the whole sites.json in your editor, also when it is not valid</li>
<li><a href="#command-doctor"><code>doctor</code></a>: Check Node.js, the folders, the credential store, the terminal and every site</li>
<li><a href="#command-shell-init"><code>shell-init</code></a>: Print the "ssv" shell function that changes to a chosen site's folder (bash, zsh, fish, pwsh, cmd)</li>
<li><a href="#command-help"><code>help</code></a>: Show help for a command</li>
</ul>
<h3 id="global-options">Global options</h3>
<p>Every command takes these.</p>
<table>
<caption>Global options</caption>
<thead><tr><th scope="col">Option</th><th scope="col">Does</th></tr></thead>
<tbody>
<tr><td><code>--site <name></code></td><td>The site to work on, by name or id</td></tr>
<tr><td><code>--server <name></code></td><td>The server to work on, by name or id</td></tr>
<tr><td><code>--config-dir <folder></code></td><td>Use this settings folder</td></tr>
<tr><td><code>--state-dir <folder></code></td><td>Use this state folder</td></tr>
<tr><td><code>--json</code></td><td>Write one JSON document to stdout</td></tr>
<tr><td><code>--plain</code></td><td>Use numbered line prompts, never a full-screen interface</td></tr>
<tr><td><code>--ascii</code></td><td>Use ASCII symbols only</td></tr>
<tr><td><code>--no-color</code></td><td>Turn colour off (NO_COLOR does too)</td></tr>
<tr><td><code>--debug</code></td><td>Also log details to stderr, with secrets removed</td></tr>
<tr><td><code>--cd-file <file></code></td><td>Write the chosen site folder here, for shell integration</td></tr>
<tr><td><code>--version</code></td><td>Print the version and exit</td></tr>
<tr><td><code>-h, --help</code></td><td>Print help and exit</td></tr>
</tbody>
</table>
<section class="command" id="command-sites">
<h3><code>sync-servers sites</code></h3>
<p>List the sites.</p>
<pre><code>sync-servers sites
sync-servers sites --json</code></pre>
</section>
<section class="command" id="command-site-add">
<h3><code>sync-servers site add</code></h3>
<p>Add a site and its first server; in a terminal, connect first and pick the root from the server.</p>
<table>
<caption>Options of site add</caption>
<thead><tr><th scope="col">Option</th><th scope="col">Does</th></tr></thead>
<tbody>
<tr><td><code>--name <name></code></td><td>The site name, unique ignoring case</td></tr>
<tr><td><code>--local-root <folder></code></td><td>The local site folder, which must exist</td></tr>
<tr><td><code>--server-name <name></code></td><td>The name of the first server (default: its host)</td></tr>
<tr><td><code>--protocol <protocol></code></td><td>sftp (default), ftps, ftps-implicit, ftp or local</td></tr>
<tr><td><code>--host <host></code></td><td>The host name or IP address; host:port and sftp://, ftps:// and ftpes:// addresses work too</td></tr>
<tr><td><code>--port <port></code></td><td>The port, when not the protocol default</td></tr>
<tr><td><code>--user <name></code></td><td>The user name</td></tr>
<tr><td><code>--auth <method></code></td><td>password, key or agent (key and agent are SFTP only)</td></tr>
<tr><td><code>--key-path <file></code></td><td>The private key file for --auth key</td></tr>
<tr><td><code>--save-password</code></td><td>Keep the password in the OS credential store (--no-save-password to stop)</td></tr>
<tr><td><code>--remote-root <path></code></td><td>The site root on the server; for local, a folder</td></tr>
<tr><td><code>--web-url <url></code></td><td>The web address of the site on this server</td></tr>
<tr><td><code>--timeout <seconds></code></td><td>Seconds to wait for the server (default 30)</td></tr>
<tr><td><code>--ip-family <4|6></code></td><td>Connect over IPv4 or IPv6 only</td></tr>
<tr><td><code>--allow-insecure</code></td><td>Allow plain FTP, which sends the password in clear text</td></tr>
<tr><td><code>--allow-root-deletes</code></td><td>Allow deletes when the remote root is "/" or a drive root</td></tr>
<tr><td><code>--legacy-algorithms</code></td><td>SFTP: allow older algorithms for an old server</td></tr>
<tr><td><code>--upload-on-save</code></td><td>Upload files when they are saved in the VS Code extension</td></tr>
<tr><td><code>--ca-file <file></code></td><td>FTPS: a PEM file of extra certificate authorities</td></tr>
<tr><td><code>--tls-servername <host></code></td><td>FTPS: the name to verify the certificate against</td></tr>
<tr><td><code>--tls-min-version <version></code></td><td>FTPS: TLSv1.2 (default) or TLSv1.3</td></tr>
<tr><td><code>--file-mode <mode></code></td><td>Permissions for uploaded files, such as 644</td></tr>
<tr><td><code>--dir-mode <mode></code></td><td>Permissions for created folders, such as 755</td></tr>
<tr><td><code>--dreamweaver-server <name></code></td><td>The name Dreamweaver gives this server in _notes/dwsync.xml, such as 203.0.113.10//public_html/; "auto" builds it from the host and the remote root</td></tr>
<tr><td><code>--dreamweaver</code></td><td>Read and update the synchronization records Dreamweaver keeps as _notes/dwsync.xml (default: when the folder holds some; --no-dreamweaver to leave them alone)</td></tr>
</tbody>
</table>
<pre><code>sync-servers site add
sync-servers site add --name "My Site" --local-root ~/sites/my-site --protocol ftps --host 203.0.113.10 --user demo-user@example.com
sync-servers site add --name "My Site" --local-root ~/sites/my-site --host sftp.example.com --user demo-user --remote-root /var/www/my-site
sync-servers site add --name "My Site" --local-root ~/sites/my-site --host server1.hosting.example.net --user demo-user --remote-root /public_html --dreamweaver-server 203.0.113.10//public_html/</code></pre>
</section>
<section class="command" id="command-site-edit">
<h3><code>sync-servers site edit [<site>]</code></h3>
<p>Change a site, with options or as JSON in your editor.</p>
<table>
<caption>Options of site edit</caption>
<thead><tr><th scope="col">Option</th><th scope="col">Does</th></tr></thead>
<tbody>
<tr><td><code>--name <name></code></td><td>Rename the site</td></tr>
<tr><td><code>--local-root <folder></code></td><td>Move the local site folder</td></tr>
<tr><td><code>--web-url <url></code></td><td>The local web address, such as http://localhost:8080/</td></tr>
<tr><td><code>--case-sensitive</code></td><td>Treat file names as case-sensitive (--no-case-sensitive to turn off)</td></tr>
<tr><td><code>--cache</code></td><td>Cache local scans between runs (--no-cache to turn off)</td></tr>
<tr><td><code>--symlinks <policy></code></td><td>Symbolic links in the local folder: skip them (skip), follow those inside the site (follow-inside-root), or follow all (follow)</td></tr>
<tr><td><code>--dreamweaver</code></td><td>Read and update the synchronization records Dreamweaver keeps as _notes/dwsync.xml (--no-dreamweaver to leave them alone)</td></tr>
<tr><td><code>--editor</code></td><td>Edit the whole site as JSON in your editor</td></tr>
</tbody>
</table>
<pre><code>sync-servers site edit "My Site" --name "Sample App"
sync-servers site edit --local-root ~/sites/my-site
sync-servers site edit --symlinks follow-inside-root
sync-servers site edit --dreamweaver
sync-servers site edit --editor</code></pre>
</section>
<section class="command" id="command-site-show">
<h3><code>sync-servers site show [<site>]</code></h3>
<p>Show a site and its servers.</p>
<pre><code>sync-servers site show
sync-servers site show "My Site" --json</code></pre>
</section>
<section class="command" id="command-site-remove">
<h3><code>sync-servers site remove <site></code></h3>
<p>Remove a site, its saved passwords and its sync records.</p>
<table>
<caption>Options of site remove</caption>
<thead><tr><th scope="col">Option</th><th scope="col">Does</th></tr></thead>
<tbody>
<tr><td><code>-y, --yes</code></td><td>Do not ask for confirmation</td></tr>
</tbody>
</table>
<pre><code>sync-servers site remove "My Site"
sync-servers site remove "My Site" --yes</code></pre>
</section>
<section class="command" id="command-site-path">
<h3><code>sync-servers site path [<site>]</code></h3>
<p>Print a site's local root (with shell integration, change to it).</p>
<pre><code>sync-servers site path "My Site"
ssv site path "My Site"</code></pre>
</section>
<section class="command" id="command-server-list">
<h3><code>sync-servers server list</code></h3>
<p>List a site's servers.</p>
<pre><code>sync-servers server list
sync-servers server list --site "My Site" --json</code></pre>
</section>
<section class="command" id="command-server-add">
<h3><code>sync-servers server add</code></h3>
<p>Add a server to a site; in a terminal, connect first and pick the root from the server.</p>
<table>
<caption>Options of server add</caption>
<thead><tr><th scope="col">Option</th><th scope="col">Does</th></tr></thead>
<tbody>
<tr><td><code>--name <name></code></td><td>The server name, unique within the site (default: the host)</td></tr>
<tr><td><code>--protocol <protocol></code></td><td>sftp (default), ftps, ftps-implicit, ftp or local</td></tr>
<tr><td><code>--host <host></code></td><td>The host name or IP address; host:port and sftp://, ftps:// and ftpes:// addresses work too</td></tr>
<tr><td><code>--port <port></code></td><td>The port, when not the protocol default</td></tr>
<tr><td><code>--user <name></code></td><td>The user name</td></tr>
<tr><td><code>--auth <method></code></td><td>password, key or agent (key and agent are SFTP only)</td></tr>
<tr><td><code>--key-path <file></code></td><td>The private key file for --auth key</td></tr>
<tr><td><code>--save-password</code></td><td>Keep the password in the OS credential store (--no-save-password to stop)</td></tr>
<tr><td><code>--remote-root <path></code></td><td>The site root on the server; for local, a folder</td></tr>
<tr><td><code>--web-url <url></code></td><td>The web address of the site on this server</td></tr>
<tr><td><code>--timeout <seconds></code></td><td>Seconds to wait for the server (default 30)</td></tr>
<tr><td><code>--ip-family <4|6></code></td><td>Connect over IPv4 or IPv6 only</td></tr>
<tr><td><code>--allow-insecure</code></td><td>Allow plain FTP, which sends the password in clear text</td></tr>
<tr><td><code>--allow-root-deletes</code></td><td>Allow deletes when the remote root is "/" or a drive root</td></tr>
<tr><td><code>--legacy-algorithms</code></td><td>SFTP: allow older algorithms for an old server</td></tr>
<tr><td><code>--upload-on-save</code></td><td>Upload files when they are saved in the VS Code extension</td></tr>
<tr><td><code>--ca-file <file></code></td><td>FTPS: a PEM file of extra certificate authorities</td></tr>
<tr><td><code>--tls-servername <host></code></td><td>FTPS: the name to verify the certificate against</td></tr>
<tr><td><code>--tls-min-version <version></code></td><td>FTPS: TLSv1.2 (default) or TLSv1.3</td></tr>
<tr><td><code>--file-mode <mode></code></td><td>Permissions for uploaded files, such as 644</td></tr>
<tr><td><code>--dir-mode <mode></code></td><td>Permissions for created folders, such as 755</td></tr>
<tr><td><code>--dreamweaver-server <name></code></td><td>The name Dreamweaver gives this server in _notes/dwsync.xml, such as 203.0.113.10//public_html/; "auto" builds it from the host and the remote root</td></tr>
<tr><td><code>--remote</code></td><td>Make it the site's Remote server, used to synchronize</td></tr>
<tr><td><code>--testing</code></td><td>Make it the site's Testing server</td></tr>
</tbody>
</table>
<pre><code>sync-servers server add
sync-servers server add --name Production --host sftp.example.com --user demo-user --remote-root /var/www/my-site
sync-servers server add --name Staging --host ftpes://ftp.example.org --user demo-user --remote-root /public --testing</code></pre>
</section>
<section class="command" id="command-server-edit">
<h3><code>sync-servers server edit [<server>]</code></h3>
<p>Change a server: asks again in a terminal, or takes options, or JSON in your editor.</p>
<table>
<caption>Options of server edit</caption>
<thead><tr><th scope="col">Option</th><th scope="col">Does</th></tr></thead>
<tbody>
<tr><td><code>--name <name></code></td><td>The server name, unique within the site (default: the host)</td></tr>
<tr><td><code>--protocol <protocol></code></td><td>sftp (default), ftps, ftps-implicit, ftp or local</td></tr>
<tr><td><code>--host <host></code></td><td>The host name or IP address; host:port and sftp://, ftps:// and ftpes:// addresses work too</td></tr>
<tr><td><code>--port <port></code></td><td>The port, when not the protocol default</td></tr>
<tr><td><code>--user <name></code></td><td>The user name</td></tr>
<tr><td><code>--auth <method></code></td><td>password, key or agent (key and agent are SFTP only)</td></tr>
<tr><td><code>--key-path <file></code></td><td>The private key file for --auth key</td></tr>
<tr><td><code>--save-password</code></td><td>Keep the password in the OS credential store (--no-save-password to stop)</td></tr>
<tr><td><code>--remote-root <path></code></td><td>The site root on the server; for local, a folder</td></tr>
<tr><td><code>--web-url <url></code></td><td>The web address of the site on this server</td></tr>
<tr><td><code>--timeout <seconds></code></td><td>Seconds to wait for the server (default 30)</td></tr>
<tr><td><code>--ip-family <4|6></code></td><td>Connect over IPv4 or IPv6 only</td></tr>
<tr><td><code>--allow-insecure</code></td><td>Allow plain FTP, which sends the password in clear text</td></tr>
<tr><td><code>--allow-root-deletes</code></td><td>Allow deletes when the remote root is "/" or a drive root</td></tr>
<tr><td><code>--legacy-algorithms</code></td><td>SFTP: allow older algorithms for an old server</td></tr>
<tr><td><code>--upload-on-save</code></td><td>Upload files when they are saved in the VS Code extension</td></tr>
<tr><td><code>--ca-file <file></code></td><td>FTPS: a PEM file of extra certificate authorities</td></tr>
<tr><td><code>--tls-servername <host></code></td><td>FTPS: the name to verify the certificate against</td></tr>
<tr><td><code>--tls-min-version <version></code></td><td>FTPS: TLSv1.2 (default) or TLSv1.3</td></tr>
<tr><td><code>--file-mode <mode></code></td><td>Permissions for uploaded files, such as 644</td></tr>
<tr><td><code>--dir-mode <mode></code></td><td>Permissions for created folders, such as 755</td></tr>
<tr><td><code>--dreamweaver-server <name></code></td><td>The name Dreamweaver gives this server in _notes/dwsync.xml, such as 203.0.113.10//public_html/; "auto" builds it from the host and the remote root</td></tr>
<tr><td><code>--forget-host-key</code></td><td>Remove the pinned SSH host key, after checking the new one with the host</td></tr>
<tr><td><code>--forget-certificate</code></td><td>Remove the trusted TLS certificate; the next connection verifies it again</td></tr>
<tr><td><code>--editor</code></td><td>Edit the whole server as JSON in your editor</td></tr>
</tbody>
</table>
<pre><code>sync-servers server edit Production
sync-servers server edit Production --port 2222
sync-servers server edit Production --forget-host-key
sync-servers server edit Production --forget-certificate
sync-servers server edit --editor</code></pre>
</section>
<section class="command" id="command-server-remove">
<h3><code>sync-servers server remove <server></code></h3>
<p>Remove a server, its saved passwords and its sync records.</p>
<table>
<caption>Options of server remove</caption>
<thead><tr><th scope="col">Option</th><th scope="col">Does</th></tr></thead>
<tbody>
<tr><td><code>-y, --yes</code></td><td>Do not ask for confirmation</td></tr>
</tbody>
</table>
<pre><code>sync-servers server remove Staging
sync-servers server remove Staging --site "My Site" --yes</code></pre>
</section>
<section class="command" id="command-server-test">
<h3><code>sync-servers server test [<server>]</code></h3>
<p>Connect, sign in, check the remote root and show what the server offers; in a terminal, fix what it finds.</p>
<table>
<caption>Options of server test</caption>
<thead><tr><th scope="col">Option</th><th scope="col">Does</th></tr></thead>
<tbody>
<tr><td><code>--host-key <fingerprint></code></td><td>Accept this SSH host key (SHA256:...) when it is not pinned yet, for scripts</td></tr>
<tr><td><code>--trust-certificate <sha256></code></td><td>Accept this TLS certificate (SHA-256 fingerprint) when it does not verify, for scripts</td></tr>
</tbody>
</table>
<pre><code>sync-servers server test
sync-servers server test Production --site "My Site"
sync-servers server test --host-key SHA256:<fingerprint>
sync-servers server test --trust-certificate 3A:91:5C:<...>:C4</code></pre>
</section>
<section class="command" id="command-server-set-remote">
<h3><code>sync-servers server set-remote <server></code></h3>
<p>Make a server the one synchronization uses.</p>
<pre><code>sync-servers server set-remote Production</code></pre>
</section>
<section class="command" id="command-server-set-testing">
<h3><code>sync-servers server set-testing [<server>]</code></h3>
<p>Make a server the Testing server, or clear the role.</p>
<table>
<caption>Options of server set-testing</caption>
<thead><tr><th scope="col">Option</th><th scope="col">Does</th></tr></thead>
<tbody>
<tr><td><code>--clear</code></td><td>Leave the site without a Testing server</td></tr>
</tbody>
</table>
<pre><code>sync-servers server set-testing Staging
sync-servers server set-testing --clear</code></pre>
</section>
<section class="command" id="command-password-set">
<h3><code>sync-servers password set [<server>]</code></h3>
<p>Save a password or key passphrase in the OS credential store.</p>
<table>
<caption>Options of password set</caption>
<thead><tr><th scope="col">Option</th><th scope="col">Does</th></tr></thead>
<tbody>
<tr><td><code>--kind <kind></code></td><td>password (default) or passphrase, for a private key</td></tr>
<tr><td><code>--stdin</code></td><td>Read it from standard input instead of asking</td></tr>
</tbody>
</table>
<pre><code>sync-servers password set Production
printf %s "$SECRET" | sync-servers password set Production --stdin</code></pre>
</section>
<section class="command" id="command-password-forget">
<h3><code>sync-servers password forget [<server>]</code></h3>
<p>Remove a saved password or key passphrase.</p>
<table>
<caption>Options of password forget</caption>
<thead><tr><th scope="col">Option</th><th scope="col">Does</th></tr></thead>
<tbody>
<tr><td><code>--kind <kind></code></td><td>password or passphrase; both when not given</td></tr>
</tbody>
</table>
<pre><code>sync-servers password forget Production</code></pre>
</section>
<section class="command" id="command-cloak">
<h3><code>sync-servers cloak [<path or pattern>...]</code></h3>
<p>Cloak files and folders so no operation touches them, in one site or every site, or list what is cloaked.</p>
<table>
<caption>Options of cloak</caption>
<thead><tr><th scope="col">Option</th><th scope="col">Does</th></tr></thead>
<tbody>
<tr><td><code>--path</code></td><td>Treat every argument as a path inside the local root</td></tr>
<tr><td><code>--pattern</code></td><td>Treat every argument as a pattern</td></tr>
<tr><td><code>--global</code></td><td>Work on the global patterns, which every site uses before its own</td></tr>
<tr><td><code>--list</code></td><td>Show the cloaking settings</td></tr>
<tr><td><code>--enable</code></td><td>Turn cloaking on for the site</td></tr>
<tr><td><code>--disable</code></td><td>Turn cloaking off for the site, keeping its patterns</td></tr>
<tr><td><code>--use-global</code></td><td>Use the global patterns in the site, as sites do unless told otherwise</td></tr>
<tr><td><code>--ignore-global</code></td><td>Stop using the global patterns in the site</td></tr>
</tbody>
</table>
<pre><code>sync-servers cloak .psd "archive*" node_modules/
sync-servers cloak img/raw
sync-servers cloak --global .git/ node_modules/
sync-servers cloak --list</code></pre>
</section>
<section class="command" id="command-uncloak">
<h3><code>sync-servers uncloak <path or pattern>...</code></h3>
<p>Remove cloaked paths or patterns, from one site or from the global patterns.</p>
<table>
<caption>Options of uncloak</caption>
<thead><tr><th scope="col">Option</th><th scope="col">Does</th></tr></thead>
<tbody>
<tr><td><code>--path</code></td><td>Treat every argument as a path inside the local root</td></tr>
<tr><td><code>--pattern</code></td><td>Treat every argument as a pattern</td></tr>
<tr><td><code>--global</code></td><td>Work on the global patterns, which every site uses before its own</td></tr>
</tbody>
</table>
<pre><code>sync-servers uncloak .psd
sync-servers uncloak img/raw
sync-servers uncloak --global node_modules/</code></pre>
</section>
<section class="command" id="command-sync">
<h3><code>sync-servers sync [recent] [<path>...]</code></h3>
<p>Synchronize a site with its Remote server: preview, then transfer.</p>
<table>
<caption>Options of sync</caption>
<thead><tr><th scope="col">Option</th><th scope="col">Does</th></tr></thead>
<tbody>
<tr><td><code>--put</code></td><td>Put newer files to the server</td></tr>
<tr><td><code>--get</code></td><td>Get newer files from the server</td></tr>
<tr><td><code>--both</code></td><td>Get and put newer files</td></tr>
<tr><td><code>-r, --range <time></code></td><td>With --put: only the files created or modified in the last <time>, such as 90m, 24h, 2d or 1w</td></tr>
<tr><td><code>--delete</code></td><td>Delete files missing on the other side (never-synchronized ones stay unchecked)</td></tr>
<tr><td><code>-y, --yes</code></td><td>Run without asking for confirmation</td></tr>
<tr><td><code>--preview <mode></code></td><td>Show the preview in the terminal UI (tui), your editor, plain prompts, or print it (none)</td></tr>
<tr><td><code>--dry-run</code></td><td>Show the preview and transfer nothing</td></tr>
<tr><td><code>--allow-mass-delete</code></td><td>Run deletes past the mass-delete limit without asking</td></tr>
<tr><td><code>--plan-out <file></code></td><td>Save the plan as JSON</td></tr>
<tr><td><code>--plan-in <file></code></td><td>Run a saved plan, if the site and server have not changed since</td></tr>
<tr><td><code>--host-key <fingerprint></code></td><td>Accept this SSH host key (SHA256:...) when it is not pinned yet</td></tr>
<tr><td><code>--trust-certificate <sha256></code></td><td>Accept this TLS certificate (SHA-256 fingerprint) when it does not verify</td></tr>
</tbody>
</table>
<pre><code>sync-servers sync --put
sync-servers sync --both --delete --dry-run
sync-servers sync --put --preview editor
sync-servers sync --get css img --yes
sync-servers sync --put --plan-out plan.json
sync-servers sync --put recent --range 2d
sync-servers sync --put recent -r 90m css</code></pre>
</section>
<section class="command" id="command-put">
<h3><code>sync-servers put <path>...</code></h3>
<p>Put files or folders now, with a preview only when a decision is needed.</p>
<table>
<caption>Options of put</caption>
<thead><tr><th scope="col">Option</th><th scope="col">Does</th></tr></thead>
<tbody>
<tr><td><code>-y, --yes</code></td><td>Run without asking for confirmation</td></tr>
<tr><td><code>--preview <mode></code></td><td>Show the preview in the terminal UI (tui), your editor, plain prompts, or print it (none)</td></tr>
<tr><td><code>--host-key <fingerprint></code></td><td>Accept this SSH host key (SHA256:...) when it is not pinned yet</td></tr>
<tr><td><code>--trust-certificate <sha256></code></td><td>Accept this TLS certificate (SHA-256 fingerprint) when it does not verify</td></tr>
</tbody>
</table>
<pre><code>sync-servers put css/site.css
sync-servers put img --site "My Site"</code></pre>
</section>
<section class="command" id="command-get">
<h3><code>sync-servers get <path>...</code></h3>
<p>Get files or folders now, with a preview only when a decision is needed.</p>
<table>
<caption>Options of get</caption>
<thead><tr><th scope="col">Option</th><th scope="col">Does</th></tr></thead>
<tbody>
<tr><td><code>-y, --yes</code></td><td>Run without asking for confirmation</td></tr>
<tr><td><code>--preview <mode></code></td><td>Show the preview in the terminal UI (tui), your editor, plain prompts, or print it (none)</td></tr>
<tr><td><code>--host-key <fingerprint></code></td><td>Accept this SSH host key (SHA256:...) when it is not pinned yet</td></tr>
<tr><td><code>--trust-certificate <sha256></code></td><td>Accept this TLS certificate (SHA-256 fingerprint) when it does not verify</td></tr>
</tbody>
</table>
<pre><code>sync-servers get css/site.css
sync-servers get img --site "My Site"</code></pre>
</section>
<section class="command" id="command-status">
<h3><code>sync-servers status [<path>...]</code></h3>
<p>Show what changed on each side since the last sync; transfers nothing.</p>
<table>
<caption>Options of status</caption>
<thead><tr><th scope="col">Option</th><th scope="col">Does</th></tr></thead>
<tbody>
<tr><td><code>--host-key <fingerprint></code></td><td>Accept this SSH host key (SHA256:...) when it is not pinned yet</td></tr>
<tr><td><code>--trust-certificate <sha256></code></td><td>Accept this TLS certificate (SHA-256 fingerprint) when it does not verify</td></tr>
</tbody>
</table>
<pre><code>sync-servers status
sync-servers status css --json</code></pre>
</section>
<section class="command" id="command-diff">
<h3><code>sync-servers diff <path></code></h3>
<p>Show how the local and remote copies of a file differ.</p>
<table>
<caption>Options of diff</caption>
<thead><tr><th scope="col">Option</th><th scope="col">Does</th></tr></thead>
<tbody>
<tr><td><code>--host-key <fingerprint></code></td><td>Accept this SSH host key (SHA256:...) when it is not pinned yet</td></tr>
<tr><td><code>--trust-certificate <sha256></code></td><td>Accept this TLS certificate (SHA-256 fingerprint) when it does not verify</td></tr>
</tbody>
</table>
<pre><code>sync-servers diff css/site.css</code></pre>
</section>
<section class="command" id="command-mark-synced">
<h3><code>sync-servers mark-synced <path>...</code></h3>
<p>Record files as in sync without transferring them.</p>
<table>
<caption>Options of mark-synced</caption>
<thead><tr><th scope="col">Option</th><th scope="col">Does</th></tr></thead>
<tbody>
<tr><td><code>--host-key <fingerprint></code></td><td>Accept this SSH host key (SHA256:...) when it is not pinned yet</td></tr>
<tr><td><code>--trust-certificate <sha256></code></td><td>Accept this TLS certificate (SHA-256 fingerprint) when it does not verify</td></tr>
</tbody>
</table>
<pre><code>sync-servers mark-synced css/site.css
sync-servers mark-synced .</code></pre>
</section>
<section class="command" id="command-state-reset">
<h3><code>sync-servers state reset</code></h3>
<p>Forget the sync records of a site and server; the next sync starts from scratch.</p>
<table>
<caption>Options of state reset</caption>
<thead><tr><th scope="col">Option</th><th scope="col">Does</th></tr></thead>
<tbody>
<tr><td><code>-y, --yes</code></td><td>Run without asking for confirmation</td></tr>
<tr><td><code>--dreamweaver</code></td><td>Also remove this server's entries from Dreamweaver's _notes/dwsync.xml; without it, a site that uses those records takes them over again at its next sync</td></tr>
</tbody>
</table>
<pre><code>sync-servers state reset
sync-servers state reset --site "My Site" --yes
sync-servers state reset --dreamweaver</code></pre>
</section>
<section class="command" id="command-config-path">
<h3><code>sync-servers config path</code></h3>
<p>Show the folders sync-servers reads and writes.</p>
<pre><code>sync-servers config path
sync-servers config path --json</code></pre>
</section>
<section class="command" id="command-config-edit">
<h3><code>sync-servers config edit</code></h3>
<p>Edit the whole sites.json in your editor, also when it is not valid.</p>
<pre><code>sync-servers config edit</code></pre>
</section>
<section class="command" id="command-doctor">
<h3><code>sync-servers doctor</code></h3>
<p>Check Node.js, the folders, the credential store, the terminal and every site.</p>
<pre><code>sync-servers doctor
sync-servers doctor --json</code></pre>
</section>
<section class="command" id="command-shell-init">
<h3><code>sync-servers shell-init <shell></code></h3>
<p>Print the "ssv" shell function that changes to a chosen site's folder (bash, zsh, fish, pwsh, cmd).</p>
<pre><code>eval "$(sync-servers shell-init bash)"
sync-servers shell-init fish > ~/.config/fish/functions/ssv.fish
Invoke-Expression (& sync-servers shell-init pwsh | Out-String)</code></pre>
</section>
<section class="command" id="command-help">
<h3><code>sync-servers help [<command>]</code></h3>
<p>Show help for a command.</p>
<pre><code>sync-servers help server add</code></pre>
</section>
<!-- end of generated section -->
<h2 id="preview-modes">Preview modes</h2>
<p><code>sync</code>, and <code>put</code> or <code>get</code> when a decision is needed, show a preview before anything moves. <code>--preview</code> chooses how:</p>
<table>
<caption>Values of --preview</caption>
<thead><tr><th scope="col">Mode</th><th scope="col">Shows the preview</th></tr></thead>
<tbody>
<tr><td><code>tui</code></td><td>Full screen, row by row, with the results after the run. The default in a terminal.</td></tr>
<tr><td><code>editor</code></td><td>As a text file in your editor; see <a href="#editor-mode">Editor mode</a>.</td></tr>
<tr><td><code>plain</code></td><td>As numbered rows and typed commands; see <a href="#plain-mode">Plain mode</a>.</td></tr>
<tr><td><code>none</code></td><td>Printed, followed by one yes or no question in a terminal. The default without a terminal.</td></tr>
</tbody>
</table>
<p>Without <code>--preview</code>, the mode is <code>none</code> when nobody can answer: with <code>--yes</code>, <code>--dry-run</code>, <code>--json</code>, or no terminal. Otherwise it comes from <code>SYNC_SERVERS_UI</code>, else <code>tui</code>, which becomes <code>plain</code> with <code>--plain</code>, with <code>TERM=dumb</code>, or in a terminal that cannot be put in raw mode. <code>--yes</code> together with a preview mode is a usage error.</p>
<h2 id="tui">The terminal interface</h2>
<p>Run <code>sync-servers</code> with no command. It opens at the site of the current folder, or at the list of sites. Everything works from the keyboard at 80 by 24, and <kbd>?</kbd> on any screen lists every key of that screen. <code>--ascii</code> uses ASCII symbols only, and <code>--no-color</code> or <code>NO_COLOR</code> turns colour off; every symbol stands beside a word, so nothing is lost.</p>
<p>Every screen has the same frame. Two solid lines frame the content. While rows are hidden above or below what is shown, a dashed line marks that edge; at the first or last row it disappears. Under the bottom line, the menu lists the screen's keys as <code>key = action</code>, with a pipe between them, wrapping onto more rows on a narrow terminal. The last row shows messages, the progress of a running task, or the full text of the focused row.</p>
<pre><code> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
______________________________________________________________________________
Space = CHECK/UNCHECK ALL | c = Check/Uncheck | p = Put | g = Get
s = Skip | d = Diff | a = All | q = Quit | Enter = Synchronize
css/site.css</code></pre>
<table>
<caption>Keys on every screen</caption>
<thead><tr><th scope="col">Key</th><th scope="col">Does</th></tr></thead>
<tbody>
<tr><td><kbd>Up</kbd> <kbd>Down</kbd>, <kbd>j</kbd> <kbd>k</kbd></td><td>Move</td></tr>
<tr><td><kbd>Page Up</kbd> <kbd>Page Down</kbd>, <kbd>Home</kbd> <kbd>End</kbd></td><td>Move by a page, or to the first or last row</td></tr>
<tr><td><kbd>Tab</kbd>, <kbd>Shift</kbd>+<kbd>Tab</kbd></td><td>Change pane or tab, or the preview's filter</td></tr>
<tr><td><kbd>Space</kbd></td><td>Toggle a checkbox, or change a choice; in the preview, check or uncheck every row</td></tr>
<tr><td><kbd>Enter</kbd></td><td>Activate the focused item or the screen's primary action</td></tr>
<tr><td><kbd>Esc</kbd></td><td>Go back, or cancel a question or a running task</td></tr>
<tr><td><kbd>/</kbd></td><td>Filter a list as you type</td></tr>
<tr><td><kbd>Ctrl</kbd>+<kbd>S</kbd></td><td>Save</td></tr>
<tr><td><kbd>?</kbd></td><td>Every key of this screen</td></tr>
<tr><td><kbd>q</kbd></td><td>Quit, from a top screen or the preview</td></tr>
<tr><td><kbd>Ctrl</kbd>+<kbd>C</kbd></td><td>Cancel the running task, or quit</td></tr>
</tbody>
</table>
<p>While a text field has focus, typed characters go into it; <kbd>Ctrl</kbd>+<kbd>U</kbd> clears it.</p>
<table>
<caption>Screens and their own keys</caption>
<thead><tr><th scope="col">Screen</th><th scope="col">Keys</th></tr></thead>
<tbody>
<tr><td>Sites</td><td><kbd>n</kbd> new site in one form, <kbd>Shift</kbd>+<kbd>N</kbd> new site in Site Setup, <kbd>e</kbd> edit, <kbd>Enter</kbd> open, <kbd>d</kbd> remove (the folder and server files are not touched), <kbd>c</kbd> the global cloaking patterns</td></tr>
<tr><td>Global Cloaking</td><td>The cloaking patterns every site uses before its own, one per line; <kbd>Ctrl</kbd>+<kbd>S</kbd> saves them, <kbd>Esc</kbd> asks before dropping unsaved changes</td></tr>
<tr><td>New site</td><td>Site name, Local folder, Protocol, Host, User, Password and Save password, then <kbd>Ctrl</kbd>+<kbd>S</kbd> or the Connect button: signs in, asks about a new host key or certificate, opens the folder picker, and saves the site and its server together. A refused sign-in shows under User. In a folder that holds Dreamweaver's synchronization records, it asks whether to use them and, when the server's host and folder do not say, which of Dreamweaver's servers this one is; then it takes the records over. <kbd>Esc</kbd> asks before dropping what you typed</td></tr>
<tr><td>Folder picker</td><td>The folders of the server, starting where the account opens, with the folder shown in the title: <kbd>Enter</kbd> opens a folder, <kbd>Backspace</kbd> goes up, <kbd>s</kbd> or Use this folder accepts, <kbd>Esc</kbd> cancels</td></tr>
<tr><td>Site home</td><td><kbd>s</kbd> Synchronize, <kbd>r</kbd> check for changes, <kbd>e</kbd> site settings; Put and Get newer files from the list</td></tr>
<tr><td>Site Setup</td><td>Categories on the left: Site, Servers, Local Info, Cloaking, Synchronization, Security. In Servers: <kbd>a</kbd> add, <kbd>Enter</kbd> edit, <kbd>c</kbd> duplicate, <kbd>Del</kbd> remove, <kbd>t</kbd> test, <kbd>r</kbd> make Remote, <kbd>Shift</kbd>+<kbd>T</kbd> make Testing. In Cloaking: Use global patterns turns the global patterns on or off for the site, which lists them, and Edit global patterns... opens them. In Synchronization: Dreamweaver sync files reads and updates the records Dreamweaver keeps in <code>_notes/dwsync.xml</code>, and needs Maintain sync information</td></tr>
<tr><td>Server editor</td><td><kbd>Tab</kbd> switches Basic and Advanced. Basic: Protocol, Host (<code>host:port</code> fills Port), Port, User, Root directory with Browse..., Test. Test and Browse connect with the values the form shows, without saving them; what they decide, such as a trusted certificate, is saved with the server on <kbd>Ctrl</kbd>+<kbd>S</kbd>. Advanced holds the Web URL, the name Dreamweaver gives the server, the host key and the trusted certificate, with Forget buttons</td></tr>
<tr><td>Synchronize</td><td>Direction and the delete option; <kbd>Enter</kbd> scans and opens the preview. The first direction, Put files from a time range, shows a Time range field in place of the delete option, holding <code>1d</code> or the last range used for the site: a number and <code>m</code>, <code>h</code>, <code>d</code> or <code>w</code>, such as <code>90m</code>, <code>24h</code>, <code>2d</code> or <code>1w</code>. Its preview holds only the files created or modified in that time. Put newer files to remote stays the direction a site first opens with</td></tr>
<tr><td>Preview</td><td><kbd>Space</kbd> check or uncheck every row (all unchecked when most are checked, else all checked), <kbd>c</kbd> check or uncheck the focused row, <kbd>p</kbd> Put, <kbd>g</kbd> Get, <kbd>s</kbd> Skip, <kbd>m</kbd> mark synchronized, <kbd>x</kbd> delete, <kbd>a</kbd> check all, or uncheck all when all are checked, <kbd>d</kbd> difference, <kbd>Tab</kbd> filter, <kbd>Enter</kbd> synchronize, <kbd>q</kbd> quit without transferring anything, as <kbd>Ctrl</kbd>+<kbd>C</kbd> does</td></tr>
<tr><td>Progress</td><td><kbd>Esc</kbd> cancels cleanly between files</td></tr>
<tr><td>Results</td><td>Failures first; <kbd>Esc</kbd> done</td></tr>
</tbody>
</table>
<p>The terminal is restored on every way out: a normal exit, <kbd>Ctrl</kbd>+<kbd>C</kbd>, a signal, or an error.</p>
<h2 id="editor-mode">Editor mode</h2>
<p><code>--preview editor</code>, or <code>SYNC_SERVERS_UI=editor</code>, writes the plan to a private temporary file and opens it in the first of <code>SYNC_SERVERS_EDITOR</code>, <code>VISUAL</code> and <code>EDITOR</code>, else Notepad on Windows or <code>nano</code>, then <code>vi</code>, elsewhere. An editor that returns at once, such as VS Code, needs its wait flag: <code>SYNC_SERVERS_EDITOR="code --wait"</code>.</p>
<pre><code># sync-servers preview: My Site -> Production (SFTP)
# Put newer files to remote
# Files: 37 will be updated, 169 will be skipped, 12 need a decision
#
# Check or uncheck a box, or change the action word, then save and close to
# synchronize. Close without saving, or delete every row, to cancel.
# put get skip synced delete-remote delete-local
#
[x] put 1 img/hero.svg
[ ] resolve 3 css/site.css # Changed locally and on the server.
[ ] put 4 .env # Matches the sensitive pattern ".env".</code></pre>
<p>The number identifies the row; the path is there to read and is checked against the number. A deleted row is skipped. A number the plan does not hold, a changed path, an unknown action, an action the file cannot take, or a <code>resolve</code> row left checked reopens the file with the problems as comments at the top. An edit can only choose among the planned rows; it can never add a path.</p>
<h2 id="plain-mode">Plain mode</h2>
<p><code>--plain</code>, <code>TERM=dumb</code>, or a terminal without raw mode runs every flow as numbered prompts, with no alternate screen and no cursor movement, which screen readers and logging terminals follow. With no command it shows the sites as a numbered list and a menu for the chosen site. The preview prints numbered rows and takes commands:</p>
<table>
<caption>Plain preview commands</caption>
<thead><tr><th scope="col">Command</th><th scope="col">Does</th></tr></thead>
<tbody>
<tr><td><code>3</code>, <code>1 4</code>, <code>2-6</code></td><td>Check or uncheck rows</td></tr>
<tr><td><code>p</code>, <code>g</code>, <code>s</code>, <code>m</code> and row numbers</td><td>Set Put, Get, Skip or Synchronized</td></tr>
<tr><td><code>x</code> and row numbers</td><td>Delete, asking where when both copies exist</td></tr>
<tr><td><code>all</code>, <code>none</code></td><td>Check or uncheck every row that can run</td></tr>
<tr><td><code>diff 3</code></td><td>Show how the two copies of a row differ</td></tr>
<tr><td><code>list</code>, <code>help</code></td><td>Show the rows, or the commands, again</td></tr>
<tr><td><code>go</code></td><td>Synchronize the checked rows, after one question</td></tr>
<tr><td><code>q</code></td><td>Cancel, transferring nothing</td></tr>
</tbody>
</table>
<h2 id="unattended">Unattended runs</h2>
<ul>
<li>Without a terminal, nothing ever asks. A secret that cannot be found fails with <code>E_AUTH</code>; an unknown SSH host key is refused unless <code>--host-key</code> names it.</li>
<li><code>sync</code> without <code>--yes</code> prints the preview and transfers nothing, so a script that forgets the flag does no harm.</li>
<li><code>--yes</code> runs the checked rows. Rows that need a decision are never decided for you: they are reported, and the exit code is 3.</li>
<li>Deletes run only with both <code>--delete</code> and <code>--yes</code>, and past the mass-delete limit only with <code>--allow-mass-delete</code> as well.</li>
<li><code>--plan-out plan.json</code> saves the plan; <code>--plan-in plan.json</code> runs it later, after checking that a fresh scan still matches what the plan was built from.</li>
<li><code>--range 2d</code> needs no direction, since a <a href="synchronization.html#range">time range</a> is always a Put. When no file is recent, the command says so, connects to nothing and exits 0.</li>
</ul>
<pre><code>SYNC_SERVERS_PASSWORD="$DEPLOY_PASSWORD" \
sync-servers sync --put --yes --site "My Site" --host-key SHA256:<fingerprint></code></pre>
<h2 id="shell-integration">Shell integration</h2>
<p>A program cannot change its shell's folder. <code>sync-servers shell-init <shell></code> prints a small <code>ssv</code> function that runs <code>sync-servers</code> with <code>--cd-file</code> and then changes to the folder of the site you chose. It changes folder only to an existing local folder of a configured site.</p>
<table>
<caption>Installing ssv</caption>
<thead><tr><th scope="col">Shell</th><th scope="col">Add</th></tr></thead>
<tbody>
<tr><td>bash, zsh</td><td><code>eval "$(sync-servers shell-init bash)"</code> in <code>~/.bashrc</code>, or <code>zsh</code> in <code>~/.zshrc</code></td></tr>
<tr><td>fish</td><td><code>sync-servers shell-init fish > ~/.config/fish/functions/ssv.fish</code></td></tr>
<tr><td>PowerShell</td><td><code>Invoke-Expression (& sync-servers shell-init pwsh | Out-String)</code> in your profile</td></tr>
<tr><td>cmd</td><td><code>sync-servers shell-init cmd > "%USERPROFILE%\bin\ssv.cmd"</code>, with that folder on <code>PATH</code></td></tr>
</tbody>
</table>
<p>Then <code>ssv</code> opens the sites and lands in the one you open, and <code>ssv site path "My Site"</code> goes straight there.</p>
<h2 id="exit-codes">Exit codes</h2>
<table>
<caption>What the exit code means</caption>
<thead><tr><th scope="col">Code</th><th scope="col">Meaning</th></tr></thead>
<tbody>
<tr><td>0</td><td>Done, or nothing to do</td></tr>
<tr><td>1</td><td>Error: the command could not run</td></tr>
<tr><td>2</td><td>Usage error, or no site could be chosen</td></tr>
<tr><td>3</td><td>Finished, with failed rows or rows still waiting for a decision</td></tr>
<tr><td>4</td><td>Cancelled</td></tr>
<tr><td>5</td><td>Stopped by a safety guard: host key mismatch, insecure protocol, empty root or mass delete</td></tr>
</tbody>
</table>
<h2 id="json">JSON output</h2>
<p><code>--json</code> writes one JSON document to standard output and nothing else; progress and warnings go to standard error. Every document names its kind and version, so a script can tell when the shape changes:</p>
<pre><code>{
"schema": "sync-servers/status@1",
"siteId": "3f2b7c1e-8a4d-4f6b-9c2e-1d5a7b9e0c31",
"local": [{ "path": "css/site.css", "state": "local-changed" }],
...
}</code></pre>
<p>The kinds are <code>sites</code>, <code>site</code>, <code>site-removed</code>, <code>site-path</code>, <code>servers</code>, <code>server</code>, <code>server-removed</code>, <code>server-test</code>, <code>cloaking</code>, <code>cloaking-global</code>, <code>sync</code>, <code>status</code>, <code>diff</code>, <code>mark-synced</code>, <code>config-paths</code>, <code>doctor</code> and <code>error</code>. Paths are site-relative, and secrets never appear.</p>
<p>A <code>sync</code> document holds the <code>plan</code> and the <code>result</code>, which is <code>null</code> when nothing ran. One made with <code>--range</code> also holds the range as it was read and the moment it starts:</p>
<pre><code>{
"schema": "sync-servers/sync@1",
"plan": { "direction": "put", "scope": { "kind": "paths", "paths": ["css/site.css", "index.html"] }, ... },
"result": null,
"range": { "text": "2d", "since": "2026-10-27T12:00:00.000Z" }
}</code></pre>
</main>
<footer class="site-footer">
<div class="inner">
<p>cmd-sync-servers is open source under the MIT license. Source, issues and releases are on <a href="https://github.com/isocialPractice/cmd-sync-servers">GitHub</a>.</p>
</div>
</footer>
</body>
</html>