-
Notifications
You must be signed in to change notification settings - Fork 1
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 dispatch init
command
#78
Conversation
This also still needs tests and docs update, but I wanted to start discussion earlier. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding a couple of tests would be amazing 👍
If end-to-end tests are difficult to craft, at least testing the core functions like those copying files to make sure they are correct would go a long way!
Ok, I think it's ready. I've also created a templates repo, please review it: https://github.com/dispatchrun/dispatch-templates |
"dispatch init will try to get the SHA of the latest commit from the repository and compare it to local SHA. If values differ, Dispatch CLI will propose user to update templates first." Can we skip the question about updating templates and do it transparently to the user? |
Yes, let's do it 👍 |
Looks like there's a test that's failing when I run it 🤔
|
I'm curious whether we could leave the current directly as-is instead of removing all the files:
Even if we ask the user, removing their files seems like a dangerous choice to make... mistakes happen easily. Another alternative could be to simply refuse to initialize a template in a non-empty directory, then we don't need to prompt them either. |
I agree. Fixed |
Weird. This is a test for the |
It seems to be there:
I expect we would get a different error if the program wasn't found as well. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really nice work on this 👏
I've created a separate issue for the failing test and other |
This PR implements
dispatch init
command to initialize a new project.Usage
Where
<template>
is a required option and[path]
is optional.Templates directory
On a first use the command will create an Application Data directory
dispatch
%APPDATA%
or%LOCALAPPDATA%
.$HOME/Library/Application Support
.$XDG_CONFIG_HOME or $HOME/.config
.The App Data directory is used to save templates oh a user's computer to make them available for use later without Internet.
The directory has follows structure:
Workflow
dispatch init <template>
will try to get the SHA of the latest commit from the repository and compare it to local SHA. If values differ, Dispatch CLI will download update for templates first.<template>
option) to a current working directory or to the[path]
if it was provided.If the destination directory is not empty, user will be asked if they want to clear the directory
Try it
This will create
cat-facts
template in thedispatch-template-test
of your home directory.Note that build directory can be different for your computer's arch and OS
To clear templates cache
if you use MacOS
Notes and open questions
dispatch init
command #59), butgit clone
instead (althoughinit
's caching and templates updating features could be still useful)Shouldit's in the Dispatch groupdispatch init
go to theDispatch Commands
group or should it be in theAdditional Commands
in thedispatch -h
output?Closes #59