Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOCS-3430: Add viam machines part cp command #3905

Merged
merged 7 commits into from
Jan 24, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 23 additions & 2 deletions docs/dev/tools/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -1160,6 +1160,7 @@
viam machines part run --organization=<org name> --location=<location name> --machine=<machine id> [--stream] --data <meth>
viam machines part shell --organization=<org name> --location=<location name> --machine=<machine id>
viam machines part restart --machine=<machine id> --part=<part id>
viam machines part cp --organization=<org name> --location=<location name> --machin=<machine id> --part=<pard name> <file name> machine:/path/to/file

Check failure on line 1163 in docs/dev/tools/cli.md

View workflow job for this annotation

GitHub Actions / runner / codespell

pard ==> part
npentrel marked this conversation as resolved.
Show resolved Hide resolved
```

Examples:
Expand Down Expand Up @@ -1190,6 +1191,24 @@

# restart a part of a specified machine
viam machines part restart --machine=123 --part=456

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason these examples use a space and not an = like the other examples in this code block? Seems they should be consistent with above as well as with the template where you have =<> if both work?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed

# Copy a single file to the machine with a new name:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds ambiguous as to whether it's the same machine name or file name or directory name. Same comment on the two below.

viam machine part cp --organization "org" --location "location" --machine "m1" --part "m1-main" my_file machine:/home/user/

# Recursively copy a directory to the machine with the same name:
viam machine part cp --part "m1-main" -r my_dir machine:/home/user/
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you're using a part name instead of a part ID, per the Slack thread don't you need to pass organization and location? Maybe just make all of these IDs instead of names?


# Copy multiple files to the machine with recursion and keep original permissions and metadata:
viam machine part cp --part "m1-main" -r -p my_dir my_file machine:/home/user/some/existing/dir/

# Copy a single file from the machine to a local destination:
viam machine part cp --part "m1-main" machine:my_file ~/Downloads/

# Recursively copy a directory from the machine to a local destination with the same name:
viam machine part cp --part "m1-main" -r machine:my_dir ~/Downloads/

# Copy multiple files from the machine to a local destination with recursion and keep original permissions and metadata:
viam machine part cp --part "m1-main" -r -p machine:my_dir machine:my_file ~/some/existing/dir/
```

#### Command options
Expand All @@ -1201,7 +1220,7 @@
| `api-key` | Work with an api-key for your machine | `create` (see [positional arguments: api-key](#positional-arguments-api-key)) |
| `status` | Retrieve machine status for a specified machine | - |
| `logs` | Retrieve logs for a specified machine | - |
| `part` | Manage a specified machine part | `status`, `run`, `logs`, `shell`, `restart` (see [positional arguments: part](#positional-arguments-part)) |
| `part` | Manage a specified machine part | `status`, `run`, `logs`, `shell`, `restart` (see [positional arguments: part](#positional-arguments-part)), `cp` |
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| `part` | Manage a specified machine part | `status`, `run`, `logs`, `shell`, `restart` (see [positional arguments: part](#positional-arguments-part)), `cp` |
| `part` | Manage a specified machine part | `status`, `run`, `logs`, `shell`, `restart`, `cp` (see [positional arguments: part](#positional-arguments-part)) |

I think? And cp should be added to positional args: part?

| `--help` | Return help | - |

##### Positional arguments: `api-key`
Expand Down Expand Up @@ -1231,7 +1250,7 @@
| -------- | ----------- | ------------------- | --------- |
| `--organization` | Organization name or ID that the machine belongs to | `list`, `status`, `logs`, `part` | **Required** |
| `--location` | Location name or ID that the machine belongs to or to list machines in | `list`, `status`, `logs`, `part` | **Required** |
| `--machine` | Machine name or ID for which the command is being issued | `status`, `logs`, `part`, `part restart` | **Required** |
| `--machine` | Machine name or ID for which the command is being issued | `status`, `logs`, `part` | **Required** |
npentrel marked this conversation as resolved.
Show resolved Hide resolved
| `--errors` | Boolean, return only errors (default: false) | `logs` | Optional |
| `--levels` | Filter logs by levels (debug, info, warn, error). Accepts multiple inputs in comma-separated list. | `logs` | Optional |
| `--part` | Part name or ID for which the command is being issued | `logs`, `part` | Optional |
Expand All @@ -1247,6 +1266,8 @@
| `--machine-id` | The machine to create an API key for | `api-key` | **Required** |
| `--name` | The optional name of the API key | `api-key` | Optional |
| `--org-id` | The optional organization ID to attach the key to | `api-key` | Optional |
| `--recursive`, `-r` | Preserve modification times and file mode bits from the source files. Default: `false`. | `part cp` | Optional |
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like these two descriptions are swapped

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good spot

| `--preserve`, `-p` | Recursively copy files. Default: `false`. | `part cp` | Optional |
npentrel marked this conversation as resolved.
Show resolved Hide resolved

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

Expand Down
4 changes: 3 additions & 1 deletion docs/manage/troubleshoot/troubleshoot.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ Once you have added the fragment, you can use the [Viam CLI](/dev/tools/cli/) to
viam machines part shell --organization=<org name> --location=<location name> --machine=<machine id>
```

TODO: You can [access the local log file](/operate/reference/viam-server/manage-viam-server/#view-viam-server-logs) on your machine if needed.
You can [access the local log file](/operate/reference/viam-server/manage-viam-server/#view-viam-server-logs) on your machine if needed.

If you need to copy files from your machine, use the [`viam machine part cp`](/dev/tools/cli/#machines-alias-robots) command.

## Restart your machine

Expand Down
Loading