cli
cli copied to clipboard
[New command] `exercism cd`
Problem
We find newcomers raising issues unable to run test and submit commands. Recent example: https://github.com/exercism/exercism/issues/5313 but I have seen many before. They usually don't cd into the exercise directory before running commands and are confused by all the errors.
Feature Request
We have exercism workspace command which prints workspace path. It would be nice to have a command to cd into exercise directory given a track and exercise slug.
exercism cd track slug
We can then modify our READMEs asking users to run this command before running commands like test and submit. It will also take care of cross-platform paths with forward and backward slashes which installation/exercise instructions don't have to worry about.
Alternatives
We can use workspace command with bash eval, but I am not sure if this will work with windows.
cd `exercism workspace`/javascript/hello-world
Adding such a subcommand is sadly not possible, as a process can't change the CWD of their parents.
But as you already said, on shells that support it, expansion/interpolation can be used:
cd $(exercism workspace)/track/exercisecd $(exercism download --track=track --exercise=exercise(works with--uuid=uuidas well)
Perhaps though indeed a command might be helpfull that would print the path to a certain exercise, such that we can use it like this?
cd $(exercism path track)to get to a certain tracks foldercd $(exercism path track exercise)to get to a certain exercises foldercd $(exercism path --uuid=uuid)to get to a certain exercises folder which is identified by its UUID, should work for own exercises at least, bonus points if it also works for mentored ones.cd $(exercism path --user=user track [exercise])to get to a tracks or exercises folder of the given user, if available.
This command should not download anything and avoid hitting the API at all costs.
On Thu, Jun 18, 2020 at 01:07:08AM -0700, Tejas Bubane wrote:
Feature Request
We have
exercism workspacecommand which prints workspace path. It would be nice to have a command tocdinto exercise directory given a track and exercise slug.exercism cd track slug
Perhaps instead of a new command, integrate the directory switch into the download command?
We can then modify our READMEs asking users to run this command before running commands like
testandsubmit. It will also take care of cross-platform paths with forward and backward slashes which installation/exercise instructions don't have to worry about.
This would end up being transparent to the user, and just do the "Right Thing™".