Skip to content

Commit 2284075

Browse files
authored
Merge pull request #2438 from pratikjagrut/fix.doc
docs: update sync help msg and documentation
2 parents 12c0cfa + a5dfdf3 commit 2284075

3 files changed

Lines changed: 42 additions & 26 deletions

File tree

cmd/sync.go

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@ package cmd
33
import (
44
"context"
55
"fmt"
6+
"os"
7+
68
runtimevar "github.com/loft-sh/devspace/pkg/devspace/config/loader/variable/runtime"
79
"github.com/loft-sh/devspace/pkg/devspace/config/localcache"
810
"github.com/loft-sh/devspace/pkg/devspace/config/versions"
911
devspacecontext "github.com/loft-sh/devspace/pkg/devspace/context"
1012
"github.com/loft-sh/devspace/pkg/devspace/kubectl"
1113
"github.com/loft-sh/devspace/pkg/devspace/services/sync"
12-
"os"
1314

1415
"github.com/loft-sh/devspace/pkg/devspace/hook"
1516

@@ -63,18 +64,17 @@ func NewSyncCmd(f factory.Factory, globalFlags *flags.GlobalFlags) *cobra.Comman
6364
Use: "sync",
6465
Short: "Starts a bi-directional sync between the target container and the local path",
6566
Long: `
66-
#######################################################
67-
################### devspace sync #####################
68-
#######################################################
69-
Starts a bi-directionaly sync between the target container
70-
and the current path:
71-
72-
devspace sync
73-
devspace sync --local-path=subfolder --container-path=/app
74-
devspace sync --exclude=node_modules --exclude=test
75-
devspace sync --pod=my-pod --container=my-container
76-
devspace sync --container-path=/my-path
77-
#######################################################`,
67+
#############################################################################
68+
################### devspace sync ###########################################
69+
#############################################################################
70+
Starts a bi-directional(default) sync between the target container path
71+
and local path:
72+
73+
devspace sync --path=.:/app # localPath is current dir and remotePath is /app
74+
devspace sync --path=.:/app --image-selector nginx:latest
75+
devspace sync --path=.:/app --exclude=node_modules,test
76+
devspace sync --path=.:/app --pod=my-pod --container=my-container
77+
#############################################################################`,
7878
RunE: func(cobraCmd *cobra.Command, args []string) error {
7979
// Print upgrade message if new version available
8080
upgrade.PrintUpgradeMessage(f.GetLog())

docs/pages/cli/devspace_sync.md

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,17 @@ devspace sync [flags]
1414
```
1515

1616
```
17-
#######################################################
18-
################### devspace sync #####################
19-
#######################################################
20-
Starts a bi-directionaly sync between the target container
21-
and the current path:
17+
#############################################################################
18+
################### devspace sync ###########################################
19+
#############################################################################
20+
Starts a bi-directional(default) sync between the target container path
21+
and local path:
2222
23-
devspace sync
24-
devspace sync --local-path=subfolder --container-path=/app
25-
devspace sync --exclude=node_modules --exclude=test
26-
devspace sync --pod=my-pod --container=my-container
27-
devspace sync --container-path=/my-path
28-
#######################################################
23+
devspace sync --path=.:/app # localPath is current dir and remotePath is /app
24+
devspace sync --path=.:/app --image-selector nginx:latest
25+
devspace sync --path=.:/app --exclude=node_modules,test
26+
devspace sync --path=.:/app --pod=my-pod --container=my-container
27+
#############################################################################`
2928
```
3029

3130

@@ -66,4 +65,3 @@ devspace sync --container-path=/my-path
6665
-s, --switch-context Switches and uses the last kube context and namespace that was used to deploy the DevSpace project
6766
--var strings Variables to override during execution (e.g. --var=MYVAR=MYVALUE)
6867
```
69-

docs/pages/configuration/dev/connections/file-sync.mdx

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,25 @@ This option is often useful if you want to download a dependency folder (e.g. `n
140140
:::
141141

142142

143+
## Start sync log
144+
By default the sync log is disabled but it can be enabled with option `printLogs: true`.
145+
146+
```yaml {11-13}
147+
deployments:
148+
app-backend:
149+
helm:
150+
values:
151+
containers:
152+
- image: ghcr.io/org/project/image
153+
154+
dev:
155+
my-dev:
156+
imageSelector: ghcr.io/org/project/image
157+
sync:
158+
- path: ./
159+
printLogs: true
160+
```
161+
143162
## Sync-Triggered Actions
144163
Sometimes it is useful to execute commands after the sync uploads files/directories between the local filesystem and the container.
145164

@@ -409,7 +428,6 @@ Polling might increase CPU consumption of the container drastically, depending o
409428
If the `noWatch` option is specified, DevSpace will stop syncing after initially comparing and resolving differences. This is useful if you want a one-time sync, but then continue doing other steps in your pipeline.
410429

411430

412-
413431
## FAQ
414432

415433
<details>

0 commit comments

Comments
 (0)