Skip to content

Commit 3eb31c8

Browse files
authored
DOCS-3430: Add viam machines part cp command (#3905)
1 parent d51686a commit 3eb31c8

File tree

2 files changed

+27
-3
lines changed

2 files changed

+27
-3
lines changed

Diff for: docs/dev/tools/cli.md

+24-2
Original file line numberDiff line numberDiff line change
@@ -1178,6 +1178,7 @@ viam machines part status --organization=<org name> --location=<location name> -
11781178
viam machines part run --organization=<org name> --location=<location name> --machine=<machine id> [--stream] --data <meth>
11791179
viam machines part shell --organization=<org name> --location=<location name> --machine=<machine id>
11801180
viam machines part restart --machine=<machine id> --part=<part id>
1181+
viam machines part cp --organization=<org name> --location=<location name> --machine=<machine id> --part=<part name> <file name> machine:/path/to/file
11811182
```
11821183

11831184
Examples:
@@ -1208,6 +1209,24 @@ viam.service.vision.v1.VisionService.GetClassificationsFromCamera
12081209

12091210
# restart a part of a specified machine
12101211
viam machines part restart --machine=123 --part=456
1212+
1213+
# Copy and a single file to a machine and change the file's name:
1214+
viam machine part cp --organization=my_org --location=my_location --machine=my_machine --part=m1-main my_file machine:/home/user/
1215+
1216+
# Recursively copy a directory to a machine:
1217+
viam machine part cp --machine=123 --part=123 -r my_dir machine:/home/user/
1218+
1219+
# Copy multiple files to a machine with recursion and keep original permissions and metadata for the files:
1220+
viam machine part cp --machine=123 --part=123 -r -p my_dir my_file machine:/home/user/some/existing/dir/
1221+
1222+
# Copy a single file from a machine to a local destination:
1223+
viam machine part cp --machine=123 --part=123 machine:my_file ~/Downloads/
1224+
1225+
# Recursively copy a directory from a machine to a local destination:
1226+
viam machine part cp --machine=123 --part=123 -r machine:my_dir ~/Downloads/
1227+
1228+
# Copy multiple files from the machine to a local destination with recursion and keep original permissions and metadata for the files:
1229+
viam machine part cp --machine=123 --part=123 -r -p machine:my_dir machine:my_file ~/some/existing/dir/
12111230
```
12121231

12131232
#### Command options
@@ -1219,7 +1238,7 @@ viam machines part restart --machine=123 --part=456
12191238
| `api-key` | Work with an api-key for your machine | `create` (see [positional arguments: api-key](#positional-arguments-api-key)) |
12201239
| `status` | Retrieve machine status for a specified machine | - |
12211240
| `logs` | Retrieve logs for a specified machine | - |
1222-
| `part` | Manage a specified machine part | `status`, `run`, `logs`, `shell`, `restart` (see [positional arguments: part](#positional-arguments-part)) |
1241+
| `part` | Manage a specified machine part | `status`, `run`, `logs`, `shell`, `restart`, `cp` (see [positional arguments: part](#positional-arguments-part)) |
12231242
| `--help` | Return help | - |
12241243

12251244
##### Positional arguments: `api-key`
@@ -1240,6 +1259,7 @@ viam machines part restart --machine=123 --part=456
12401259
| `logs` | Get logs for the specified machine part |
12411260
| `shell` | Access a machine part securely using a secure shell. To use this feature you must add the [`ViamShellDanger` fragment](https://app.viam.com/fragment/b511adfa-80ab-4a70-9bd5-fbb14696b17e/json) to your machine. |
12421261
| `restart` | Restart a machine part. |
1262+
| `cp` | Copy files to and from a machine part. |
12431263
| `--help` | Return help |
12441264

12451265
##### Named arguments
@@ -1249,7 +1269,7 @@ viam machines part restart --machine=123 --part=456
12491269
| -------- | ----------- | ------------------- | --------- |
12501270
| `--organization` | Organization name or ID that the machine belongs to | `list`, `status`, `logs`, `part` | **Required** |
12511271
| `--location` | Location name or ID that the machine belongs to or to list machines in | `list`, `status`, `logs`, `part` | **Required** |
1252-
| `--machine` | Machine name or ID for which the command is being issued | `status`, `logs`, `part`, `part restart` | **Required** |
1272+
| `--machine` | Machine name or ID for which the command is being issued. If machine name is used instead of ID, `--organization` and `--location` are required. | `status`, `logs`, `part` | **Required** |
12531273
| `--errors` | Boolean, return only errors (default: false) | `logs` | Optional |
12541274
| `--levels` | Filter logs by levels (debug, info, warn, error). Accepts multiple inputs in comma-separated list. | `logs` | Optional |
12551275
| `--part` | Part name or ID for which the command is being issued | `logs`, `part` | Optional |
@@ -1265,6 +1285,8 @@ viam machines part restart --machine=123 --part=456
12651285
| `--machine-id` | The machine to create an API key for | `api-key` | **Required** |
12661286
| `--name` | The optional name of the API key | `api-key` | Optional |
12671287
| `--org-id` | The optional organization ID to attach the key to | `api-key` | Optional |
1288+
| `--recursive`, `-r` | Recursively copy files. Default: `false`. | `part cp` | Optional |
1289+
| `--preserve`, `-p` | Preserve modification times and file mode bits from the source files. Default: `false`. | `part cp` | Optional |
12681290

12691291
##### Using the `--stream` and `--data` arguments
12701292

Diff for: docs/manage/troubleshoot/troubleshoot.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,9 @@ Once you have added the fragment, you can use the [Viam CLI](/dev/tools/cli/) to
7878
viam machines part shell --organization=<org name> --location=<location name> --machine=<machine id>
7979
```
8080

81-
TODO: You can [access the local log file](/operate/reference/viam-server/manage-viam-server/#view-viam-server-logs) on your machine if needed.
81+
You can [access the local log file](/operate/reference/viam-server/manage-viam-server/#view-viam-server-logs) on your machine if needed.
82+
83+
If you need to copy files from your machine, use the [`viam machine part cp`](/dev/tools/cli/#machines-alias-robots) command.
8284

8385
## Restart your machine
8486

0 commit comments

Comments
 (0)