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

Add workspace import-dir command #456

Merged
merged 25 commits into from
Jun 12, 2023
Merged

Add workspace import-dir command #456

merged 25 commits into from
Jun 12, 2023

Conversation

shreyas-goenka
Copy link
Contributor

Tests

Testing using integration tests and manually

@shreyas-goenka
Copy link
Contributor Author

case 1: target directory does not exist

shreyas.goenka@THW32HFW6T vandaley-industries % cli workspace import-dir foo /Users/me@example.com/remote-dir
.gitignore -> /Users/me@example.com/remote-dir/.gitignore
apple -> /Users/me@example.com/remote-dir/apple
hello_world.py -> /Users/me@example.com/remote-dir/hello_world
mango -> /Users/me@example.com/remote-dir/mango
veggies/tomatoes -> /Users/me@example.com/remote-dir/veggies/tomatoes

case 2: A few preexisting files at target dir

shreyas.goenka@THW32HFW6T vandaley-industries % cli workspace import-dir foo /Users/me@example.com/remote-dir
.gitignore -> /Users/me@example.com/remote-dir/.gitignore (skipped; already exists)
apple -> /Users/me@example.com/remote-dir/apple
hello_world.py -> /Users/me@example.com/remote-dir/hello_world (skipped; already exists)
mango -> /Users/me@example.com/remote-dir/mango
veggies/tomatoes -> /Users/me@example.com/remote-dir/veggies/tomatoes

case 3: preexisting files, but overwrite flag is set

shreyas.goenka@THW32HFW6T vandaley-industries % cli workspace import-dir foo /Users/me@example.com/remote-dir --overwrite
.gitignore -> /Users/me@example.com/remote-dir/.gitignore
apple -> /Users/me@example.com/remote-dir/apple
hello_world.py -> /Users/me@example.com/remote-dir/hello_world
mango -> /Users/me@example.com/remote-dir/mango
veggies/tomatoes -> /Users/me@example.com/remote-dir/veggies/tomatoes

case 4: json output mode

shreyas.goenka@THW32HFW6T vandaley-industries % cli workspace import-dir foo /Users/me@example.com/remote-dir --overwrite --output=json
{
  "source_path":"/Users/shreyas.goenka/projects/vandaley-industries/foo",
  "type":"IMPORT_STARTED"
}
{
  "source_path":".gitignore",
  "target_path":"/Users/me@example.com/remote-dir/.gitignore",
  "type":"FILE_IMPORTED"
}
{
  "source_path":"apple",
  "target_path":"/Users/me@example.com/remote-dir/apple",
  "type":"FILE_IMPORTED"
}
{
  "source_path":"hello_world.py",
  "target_path":"/Users/me@example.com/remote-dir/hello_world",
  "type":"FILE_IMPORTED"
}
{
  "source_path":"mango",
  "target_path":"/Users/me@example.com/remote-dir/mango",
  "type":"FILE_IMPORTED"
}
{
  "source_path":"veggies/tomatoes",
  "target_path":"/Users/me@example.com/remote-dir/veggies/tomatoes",
  "type":"FILE_IMPORTED"
}
{
  "target_path":"/Users/me@example.com/remote-dir",
  "type":"IMPORT_COMPLETED"
}
shreyas.goenka@THW32HFW6T vandaley-industries %

cmd/workspace/workspace/import_dir.go Outdated Show resolved Hide resolved
cmd/workspace/workspace/import_dir.go Outdated Show resolved Hide resolved
internal/filer_test.go Outdated Show resolved Hide resolved
internal/filer_test.go Outdated Show resolved Hide resolved
Copy link
Contributor

@pietern pietern left a comment

Choose a reason for hiding this comment

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

Final minor issues. Everything else LGTM.

cmd/workspace/workspace/import_dir.go Show resolved Hide resolved
cmd/workspace/workspace/import_dir.go Outdated Show resolved Hide resolved
cmd/workspace/workspace/import_dir.go Show resolved Hide resolved
libs/filer/workspace_files_client.go Show resolved Hide resolved
@shreyas-goenka shreyas-goenka merged commit d386490 into main Jun 12, 2023
@shreyas-goenka shreyas-goenka deleted the import-dir-1 branch June 12, 2023 19:03
@pietern pietern mentioned this pull request Jun 15, 2023
pietern added a commit that referenced this pull request Jun 15, 2023
## Changes

CLI:
* Add workspace import-dir command
([#456](#456)).
* Annotate generated commands with OpenAPI package name
([#466](#466)).
* Associate generated commands with command groups
([#475](#475)).
* Disable shell completions for generated commands
([#483](#483)).
* Include [DEFAULT] section header when writing ~/.databrickscfg
([#464](#464)).
* Pass through proxy related environment variables
([#465](#465)).
* Restore flags to original values on test completion
([#470](#470)).
* Update configure command
([#482](#482)).

Dependencies:
* Bump SDK to latest
([#473](#473)).
@s4m0r4m4
Copy link

@pietern
Copy link
Contributor

pietern commented Oct 2, 2023

@s4m0r4m4 Thanks for noticing. That doc hasn't been updated after it was first added (we don't have automation for it). Out of curiosity -- are you actively using that as a reference?

@s4m0r4m4
Copy link

s4m0r4m4 commented Oct 2, 2023

I am! I used to use the legacy documentation and was trying to upgrade and use the newer documentation but it doesn't seem to be quite as fleshed out as the older stuff

@pietern
Copy link
Contributor

pietern commented Oct 3, 2023

Understood -- yeah, the docs were autogenerated from our API explorer, so the manually curated commands didn't show up there. I filed issue #829 to track this.

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.

3 participants