Commit 26213df
authored
feat: add SFTP file transfer with upload/download commands (#3)
* feat: implement SFTP upload/download with rename from copy to upload command
* update: cargo fmt
* feat: add glob pattern support for upload and download commands
- Add glob dependency for pattern matching
- Implement local glob expansion for upload command
- Support uploading multiple files with wildcards (*.txt, logs/*.log)
- Implement remote glob expansion for download via SSH ls command
- Support downloading multiple files with wildcards
- Add automatic directory detection for multi-file uploads
- Add human-readable file size formatting
- Update manpage with glob pattern examples
- Add test_glob.sh script for testing glob functionality
This allows users to:
- Upload multiple files: bssh upload "*.log" /remote/dir/
- Download with patterns: bssh download "/var/log/*.log" ./downloads/
* test: add comprehensive tests for upload/download functionality
- Add unit tests for CLI command parsing (upload/download)
- Add unit tests for executor file transfer results
- Add glob pattern matching tests
- Add error handling tests for various failure scenarios
- Add integration tests for localhost SSH operations
- Test coverage for:
* Upload/download result structures
* Parallel executor with file transfers
* Glob pattern resolution
* Error cases (invalid hosts, ports, files)
* Multiple file operations
All unit tests pass (47 tests total). Integration tests require
SSH server on localhost to run successfully.
* fix: make integration tests more robust for CI environments
- Add SSH key detection for integration tests
- Only use SSH key if it exists, otherwise fall back to agent
- Update CI workflow to skip integration tests
- Fix formatting in all test files
- Ensure tests work both locally and in GitHub Actions
Integration tests now gracefully handle environments without:
- SSH keys
- SSH agent identities
- localhost SSH access
* fix: resolve clippy warnings and improve test robustness
* chore: update GitHub action
* update: packages1 parent a2e4180 commit 26213df
File tree
15 files changed
+1775
-69
lines changed- .github/workflows
- docs/man
- src
- ssh
- tests
15 files changed
+1775
-69
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
32 | | - | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
33 | 35 | | |
34 | 36 | | |
35 | 37 | | |
| |||
57 | 59 | | |
58 | 60 | | |
59 | 61 | | |
60 | | - | |
| 62 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
17 | 19 | | |
18 | 20 | | |
19 | 21 | | |
| |||
83 | 85 | | |
84 | 86 | | |
85 | 87 | | |
86 | | - | |
87 | | - | |
| 88 | + | |
| 89 | + | |
88 | 90 | | |
89 | | - | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
90 | 109 | | |
91 | 110 | | |
92 | 111 | | |
| |||
159 | 178 | | |
160 | 179 | | |
161 | 180 | | |
162 | | - | |
163 | | - | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
164 | 191 | | |
165 | 192 | | |
166 | 193 | | |
| |||
193 | 220 | | |
194 | 221 | | |
195 | 222 | | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
196 | 252 | | |
197 | 253 | | |
198 | 254 | | |
| |||
290 | 346 | | |
291 | 347 | | |
292 | 348 | | |
| 349 | + | |
293 | 350 | | |
294 | 351 | | |
295 | 352 | | |
296 | 353 | | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
297 | 369 | | |
298 | 370 | | |
299 | 371 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
104 | | - | |
105 | | - | |
106 | | - | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
107 | 107 | | |
108 | 108 | | |
109 | | - | |
| 109 | + | |
110 | 110 | | |
111 | 111 | | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
112 | 121 | | |
113 | 122 | | |
114 | 123 | | |
| |||
0 commit comments