This repository has been archived by the owner on May 11, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* issue #34 and #35 - adding new command to pull a file from a URL, rename it, put it into a folder, and even unzip it * adding a test and some documentation * adding additional tests * streamlining tests * using archive file in the github project * adding user question on overwrite or unzip * fixing test issue * moving types/download to dependencies * fix overwrite issue and update doc Signed-off-by: bfitzpat@redhat.com <bfitzpat@redhat.com>
- Loading branch information
Showing
8 changed files
with
1,079 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# Using the vscode.didact.copyFileURLtoWorkspaceCommand | ||
|
||
We have added a new `vscode.didact.copyFileURLtoWorkspaceCommand` to handle two common cases: downloading a file into the workspace, and downloading and unzipping an archive file into the workspace. We'll cover both of those cases and the variations here. | ||
|
||
## Setting up the examples | ||
|
||
Let's say we have this image: | ||
|
||
![Spongebob Squarepants Finger Guns](https://media.giphy.com/media/7DzlajZNY5D0I/giphy.gif) | ||
|
||
We can find it at this URL: https://media.giphy.com/media/7DzlajZNY5D0I/giphy.gif | ||
|
||
And let's say we have this archive file: https://github.com/redhat-developer/vscode-didact/raw/master/test-archive/testarchive.tar.gz | ||
|
||
## Copying a File into the Workspace root with no name change | ||
|
||
Let's say we want to copy it into our project. I've created a new command that takes the URL, the file name, and an optional path for the workspace. | ||
|
||
* [Click here to let it do its thing and download `giphy.gif`.](didact://?commandId=vscode.didact.copyFileURLtoWorkspaceCommand&text=https://media.giphy.com/media/7DzlajZNY5D0I/giphy.gif) | ||
* [Click here to open `giphy.gif`](didact://?commandId=vscode.open&projectFilePath=giphy.gif) | ||
|
||
Here's the Didact URL: `didact://?commandId=vscode.didact.copyFileURLtoWorkspaceCommand&text=https://media.giphy.com/media/7DzlajZNY5D0I/giphy.gif` | ||
|
||
## Copying a File and Changing the Name | ||
|
||
* [Click here to let it do its thing, but this time we'll change the filename.](didact://?commandId=vscode.didact.copyFileURLtoWorkspaceCommand&text=https://media.giphy.com/media/7DzlajZNY5D0I/giphy.gif$$spongebob.gif) | ||
* [Click here to open `spongebob.gif`](didact://?commandId=vscode.open&projectFilePath=spongebob.gif) | ||
|
||
Here's the Didact URL: `didact://?commandId=vscode.didact.copyFileURLtoWorkspaceCommand&text=https://media.giphy.com/media/7DzlajZNY5D0I/giphy.gif$$spongebob.gif` | ||
|
||
## What if we want to change the name and put it into a specific folder? | ||
|
||
This time we'll try a different Spongebob... we're getting excited! | ||
|
||
![Spongebob Squarepants Excited](https://media.giphy.com/media/nDSlfqf0gn5g4/giphy.gif) | ||
|
||
* [Click here to let it do its thing and open the downloaded file, but this time we'll put it in a new folder and change the filename again.](didact://?commandId=vscode.didact.copyFileURLtoWorkspaceCommand&text=https://media.giphy.com/media/nDSlfqf0gn5g4/giphy.gif$$spongebob-excited.gif$$GIFs) | ||
* [Click here to open `GIFs/spongebob.gif`](didact://?commandId=vscode.open&projectFilePath=GIFs/spongebob-excited.gif) | ||
|
||
Here's the Didact URL: `didact://?commandId=vscode.didact.copyFileURLtoWorkspaceCommand&text=https://media.giphy.com/media/nDSlfqf0gn5g4/giphy.gif$$spongebob-excited.gif$$GIFs` | ||
|
||
## That's all well and good, but what if I have an archive file I want to pull down and unzip at the same time? | ||
|
||
This is another issue (https://github.com/redhat-developer/vscode-didact/issues/135) that came up and now we can do that too! Let's take a sample image archive and unzip it into a new folder called `expandme`. | ||
|
||
* [Click here to download and unzip the test image archive into a new directory.](didact://?commandId=vscode.didact.copyFileURLtoWorkspaceCommand&text=https://github.com/redhat-developer/vscode-didact/raw/master/test-archive/testarchive.tar.gz$$testarchive.tar.gz$$expandme$$true) | ||
* [Click here to open `expandme/testfile/spongebob-expands.gif`](didact://?commandId=vscode.open&projectFilePath=expandme/testfile/spongebob-expands.gif) | ||
|
||
Here's the Didact URL: `didact://?commandId=vscode.didact.copyFileURLtoWorkspaceCommand&text=https://github.com/redhat-developer/vscode-didact/raw/master/test-archive/testarchive.tar.gz$$testarchive.tar.gz$$expandme$$true` |
Oops, something went wrong.