-
-
Notifications
You must be signed in to change notification settings - Fork 361
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
Get rid of the workspace.Locate behavior and comms package #696
Conversation
This no longer accepts just an exercise name. It mirrors the behavior of the submit command where you pass the path to the exercise you want to open in the browser. In the future we can expand this to take --exercise, --track, and --team.
We determine the exact exercise directory based on the filepaths. Since we have the directory, we don't need to do complicated guessing, we can just load in the exercise metadata directly.
We were overloading the variable, which makes it confusing.
We're going to want to ensure that the directory exists. For the moment, this directory is the same as the exercise directory, but we're working towards putting this in a subdirectory to match common industry conventions.
We've moved the idea of the exercise metadata path onto the Exercise type.
It's no longer used.
cmd/download.go
Outdated
return errors.New("need an --exercise name or a solution --uuid") | ||
} | ||
|
||
var slug string | ||
var param string |
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.
What is param supposed to represent an exercise iteration
?
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.
param is the param to the URL that we're calling on the API. It's either the string latest
, or an actual UUID.
cmd/download.go
Outdated
return errors.New("need an --exercise name or a solution --uuid") | ||
} | ||
|
||
var slug string | ||
var param string | ||
if uuid == "" { |
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.
Yon can simplify this a bit
param := "latest"
if uuid != "" {
param = uuid
}
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.
Thanks! Yeah, that's much better. Updated.
Simplify a conditional.
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.
This is good to go.
This is big in the sense that it deletes a lot of code, but the core of the PR is three small simplifications:
Once all of those were simplified, we no longer used
SolutionPath
,IsSolutionPath
,ResolveSolutionPath
, orLocate
, and could delete all of the functions and their associated tests. And the entirecomms
package!This removes the behavior of adding a numeric suffix when downloading an exercise if the exercise already exists, which is the first step in fixing #661
The second step is to make the download command more robust so it doesn't clobber existing solution files: #697