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 support for file download path #3

Merged
merged 5 commits into from
Dec 30, 2022
Merged

Add support for file download path #3

merged 5 commits into from
Dec 30, 2022

Conversation

sarahmcdougall
Copy link
Contributor

Adds better support for specifying the download path from the CLI.

Code changes

  • Use current working directory to specify the default download path if not defined by the user
  • Get absolute path for specified destination directory via path.resolve()
  • If the specified download path does not exist, prompts the user about making new directory. Exits if user does not want to create new directory. Otherwise, makes new directory and continues the export flow.

Testing Guidance

  • Check that the default value for the -d flag works as expected
  • Check that specifying a relative path will correctly grab the absolute path and write files to the specified directory
  • Test the prompt (specifying y/n for creating the new directory) and see whether this is a good approach to use for this situation - I figure if a user makes a typo when specifying the directory and they end up specifying a directory that does not exist, they will want to exit and re-run the CLI with the correct directory

Copy link
Contributor

@radamson radamson left a comment

Choose a reason for hiding this comment

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

It works!

Left a comment on the library used because I think we may want to at least consider some alternatives.

I like the interactive directory prompt and that it displays the full path so that I know where the files would be stored. I wasn't able to get it to work with Unix yes (e.g., yes | npm run cli ...), but that is not a showstopper; it would be nice if it worked for scripting though. We may want to consider a future task which allows an environment variable to be set indicating missing directories should be created.

package.json Outdated Show resolved Hide resolved
Copy link
Contributor

@radamson radamson left a comment

Choose a reason for hiding this comment

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

Works like a charm. Also, works with yes now which is nice (although it does print y in my terminal a bunch, but that's not a big deal.)

...
y
y
y
Kick-off started
Kick-off completed
...

@radamson radamson merged commit 30bedd6 into main Dec 30, 2022
@radamson radamson deleted the download-path branch December 30, 2022 12:53
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.

2 participants