Skip to content

Commit f67ad7b

Browse files
authored
feat: add cp command for file copy to/from instances (#18)
* feat: add cp command for file copy operations Add 'hypeman cp' command for copying files to/from running instances, with docker cp compatible semantics: Features: - Copy files and directories to instances: hypeman cp file.txt instance:/path - Copy from instances: hypeman cp instance:/path file.txt - STDIN/STDOUT streaming with '-' argument for tar archives - Recursive directory copying with proper tar packing/unpacking - Symlink handling with --follow-links flag - Archive mode (-a) to preserve UID/GID ownership - Quiet mode (-q) to suppress progress output - Docker cp path resolution semantics: - SRC_PATH/. copies contents, not the directory itself - Trailing slash handling for directory vs file detection The command communicates with the API server via WebSocket, streaming file data as binary chunks with JSON metadata headers. * chore: update hypeman-go dependency Update to e893d90 with circular symlink detection and root ownership fix. * fix(cp): implement copyContentsOnly for from-instance operations When copying a directory from instance to local, the /. suffix (copy contents only) was computed but not used. Now: - Without /.: creates source directory inside destination (docker cp semantics) - With /.: copies contents directly into destination * chore: update hypeman-go to v0.8.0 and remove replace directive Update to official v0.8.0 release which adds the file copy SDK functions (CpToInstance, CpFromInstance).
1 parent 1661f08 commit f67ad7b

File tree

4 files changed

+994
-3
lines changed

4 files changed

+994
-3
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ require (
1212
github.com/gorilla/websocket v1.5.3
1313
github.com/itchyny/json2yaml v0.1.4
1414
github.com/muesli/reflow v0.3.0
15-
github.com/onkernel/hypeman-go v0.7.0
15+
github.com/onkernel/hypeman-go v0.8.0
1616
github.com/tidwall/gjson v1.18.0
1717
github.com/tidwall/pretty v1.2.1
1818
github.com/urfave/cli-docs/v3 v3.0.0-alpha6

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ github.com/muesli/reflow v0.3.0 h1:IFsN6K9NfGtjeggFP+68I4chLZV2yIKsXJFNZ+eWh6s=
105105
github.com/muesli/reflow v0.3.0/go.mod h1:pbwTDkVPibjO2kyvBQRBxTWEEGDGq0FlB1BIKtnHY/8=
106106
github.com/muesli/termenv v0.16.0 h1:S5AlUN9dENB57rsbnkPyfdGuWIlkmzJjbFf0Tf5FWUc=
107107
github.com/muesli/termenv v0.16.0/go.mod h1:ZRfOIKPFDYQoDFF4Olj7/QJbW60Ol/kL1pU3VfY/Cnk=
108-
github.com/onkernel/hypeman-go v0.7.0 h1:KUeY4VGJtStA4+zkPtx7eDCO3rSznbIVoj4U6l+g50Q=
109-
github.com/onkernel/hypeman-go v0.7.0/go.mod h1:BPT1yh0gbby1E+As/xLM3GVjw7752+2C5SaEiJV9rRc=
108+
github.com/onkernel/hypeman-go v0.8.0 h1:OK6cMRUP9Z4D1PSynPHksvi94k2JFSqD3I59IlT19o0=
109+
github.com/onkernel/hypeman-go v0.8.0/go.mod h1:Wtm4ewVGGPZc2ySeeuQISQyJxujyQuyDjXyksVkIyy8=
110110
github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U=
111111
github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM=
112112
github.com/opencontainers/image-spec v1.1.1 h1:y0fUlFfIZhPF1W537XOLg0/fcx6zcHCJwooC2xJA040=

pkg/cmd/cmd.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ func init() {
6868
},
6969
Commands: []*cli.Command{
7070
&execCmd,
71+
&cpCmd,
7172
&pullCmd,
7273
&pushCmd,
7374
&runCmd,

0 commit comments

Comments
 (0)