Skip to content

feat: support multiple source files in mgrctl cp (Fixes #657)#734

Open
YatesMold wants to merge 6 commits into
uyuni-project:mainfrom
YatesMold:feat-mgrctl-cp-multi-source
Open

feat: support multiple source files in mgrctl cp (Fixes #657)#734
YatesMold wants to merge 6 commits into
uyuni-project:mainfrom
YatesMold:feat-mgrctl-cp-multi-source

Conversation

@YatesMold
Copy link
Copy Markdown

What does this PR change?

Support multiple source files in mgrctl cp by accepting MinimumNArgs(2) instead of ExactArgs(2), treating the last argument as the destination, and looping through all preceding arguments to copy each one.

Example: mgrctl cp a b server:/root/ now works instead of requiring a shell loop.

Test coverage

  • No tests: already covered

Links

Issue(s): #657

  • DONE

Changelogs

  • No changelog needed

@YatesMold YatesMold force-pushed the feat-mgrctl-cp-multi-source branch from ec2d25d to 16cbd69 Compare March 6, 2026 16:15
Copy link
Copy Markdown
Contributor

@cbosdo cbosdo left a comment

Choose a reason for hiding this comment

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

The PR looks quite good to me. I left some suggestions to make the help clearer, they may not be perfect, but it can't be left as is for sure.

The copyright year is not updated: add a copyright line with your name on the file you changed.

It would be probably nice to check that we don't have a mix of path starting with server: and not in the sources.

You also need to add a changelog file using mkchlog. see the wiki contributing page

I would also need the PR description to be in the git commit message: it makes it easier to dig in code in the future.

Comment thread mgrctl/cmd/cp/cp.go Outdated

cpCmd := &cobra.Command{
Use: "cp [path/to/source.file] [path/to/destination.file]",
Use: "cp [path/to/source1.file] [path/to/source2.file ...] [path/to/destination]",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
Use: "cp [path/to/source1.file] [path/to/source2.file ...] [path/to/destination]",
Use: "cp [path/to/source1.file ...] [path/to/destination]",

Comment thread mgrctl/cmd/cp/cp.go Outdated
Comment on lines 30 to 31
Long: L(`Takes a source and destination parameters.
One of them can be prefixed with 'server:' to indicate the path is within the server pod.`),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
Long: L(`Takes a source and destination parameters.
One of them can be prefixed with 'server:' to indicate the path is within the server pod.`),
Long: L(`Takes at lease one source and destination parameters.
Several sources files can be passed, the last parameter will be the destination.
Either the sources parameters or the destination on can be prefixed with 'server:' to indicate the path is within the server pod.`),

…#657)

Allow passing multiple source file paths to `mgrctl cp`. The last
argument is treated as the destination. All sources must be
consistently either local paths or server: prefixed paths; mixing
is not allowed.

Update the Use string and Long description to reflect the new
multi-source behavior. Add validation to reject mixed local and
server source paths.
@YatesMold YatesMold force-pushed the feat-mgrctl-cp-multi-source branch from 16cbd69 to 3735e3b Compare April 7, 2026 23:14
@YatesMold
Copy link
Copy Markdown
Author

Hi @cbosdo, I've addressed all the review feedback: fixed the Use string and Long description, added a copyright line, added validation to reject mixed local/server sources, created a changelog entry, and expanded the commit message with the PR description. Please take another look when you get a chance

@YatesMold YatesMold requested a review from cbosdo April 22, 2026 19:41
@sonarqubecloud
Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants