databricks-cli/cmd/fs
shreyas-goenka 2c0d06715c
Fix windows style file paths in fs cp command (#1118)
## Changes
Copying a local file in windows to remote directory in DBFS would fail
if the path was specified as a windows style path (compared to a UNIX
style path). This PR fixes that.

Note, UNIX style paths will continue to work because `filepath.Base`
respects both `/` and `\` as file separators. See: `IsPathSeparator` in
https://go.dev/src/os/path_windows.go.

Fixes issue: https://github.com/databricks/cli/issues/1109.

## Tests
Integration test and manually
```
C:\Users\shreyas.goenka>Desktop\cli.exe fs cp .\Desktop\foo.txt dbfs:/Users/shreyas.goenka@databricks.com
.\Desktop\foo.txt -> dbfs:/Users/shreyas.goenka@databricks.com/foo.txt

C:\Users\shreyas.goenka>Desktop\cli.exe fs cat  dbfs:/Users/shreyas.goenka@databricks.com/foo.txt
hello, world
````
2024-01-11 18:49:42 +00:00
..
cat.go Remove dependency on global state for remaining commands (#613) 2023-07-27 10:03:08 +00:00
cp.go Fix windows style file paths in fs cp command (#1118) 2024-01-11 18:49:42 +00:00
events.go Add fs cp command (#463) 2023-06-16 17:09:08 +02:00
fs.go Tweak command groups in CLI help (#1092) 2023-12-28 13:14:55 +00:00
helpers.go Add dbfs scheme prefix to paths in cp command output (#516) 2023-06-27 14:42:27 +02:00
helpers_test.go Make local files default for fs commands (#506) 2023-06-23 16:07:09 +02:00
ls.go Remove dependency on global state for remaining commands (#613) 2023-07-27 10:03:08 +00:00
mkdir.go Remove dependency on global state for remaining commands (#613) 2023-07-27 10:03:08 +00:00
rm.go Remove dependency on global state for remaining commands (#613) 2023-07-27 10:03:08 +00:00