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

nextercism: Consider a --remote flag for open #460

Open
kytrinyx opened this issue Aug 18, 2017 · 2 comments
Open

nextercism: Consider a --remote flag for open #460

kytrinyx opened this issue Aug 18, 2017 · 2 comments

Comments

@kytrinyx
Copy link
Member

Open has some nice functionality that lets you specify just the name of an exercise, and it will find all the possible matches that you have locally, and ask which one you want to open.

Many people work on multiple computers, or might not have all their Exercism work downloaded to their computer, which means that they might actually want to open something that they don't have locally.

In this case, it would be nice to provide a --remote flag which would ask the API what potential exercises we are talking about.

This will require defining in detail what the API needs to return and how the CLI will display this.

My gut feeling is that it should display the list exactly as though it were local ones.

We found more than one. Which one did you mean?
Type the number of the one you want to select it.

  [1] python/clock
  [2] go/clock
  [3] ruby/clock
  [4] elixir/clock
  [5] haskell/clock

> 

When implementing this, go ahead and write a test with a test server to fake out the API, until you get it the way you want it. A good starting point is probably:

{
	"solutions": [{
		"id": "abc-123",
		"url": "https://v2.exercism.io/my/solutions/abc-123",
		"track": {
			"track": "cpp",
			"language": "C++"
		},
		"exercise": {
			"id": "clock"
		}
	}]
}
@palash25
Copy link

I'm interested in this issue. Can you direct me to the files that need to be changed?

@kytrinyx
Copy link
Member Author

Hi @palash25, that's great.

This needs to be based off of the nextercism https://github.com/exercism/cli/tree/nextercism branch, and the command in question is the open command, which can be found in this file:
https://github.com/exercism/cli/blob/nextercism/cmd/open.go

You would need to create an open_test.go file in the cmd directory. You can see how we've added tests to https://github.com/exercism/cli/blob/nextercism/cmd/configure_test.go (or other tests in that directory).

We have an abstraction that helps us do some of the setup here: https://github.com/exercism/cli/blob/nextercism/cmd/cmd_test.go

@stale stale bot added the wontfix label Nov 30, 2017
@stale stale bot closed this as completed Dec 7, 2017
@kytrinyx kytrinyx removed the wontfix label Dec 22, 2017
@kytrinyx kytrinyx reopened this Dec 22, 2017
@exercism exercism deleted a comment from stale bot Aug 5, 2018
Smarticles101 added a commit to Smarticles101/cli that referenced this issue Jan 7, 2019
Smarticles101 added a commit to Smarticles101/cli that referenced this issue Feb 28, 2019
Smarticles101 added a commit to Smarticles101/cli that referenced this issue Feb 28, 2019
Smarticles101 added a commit to Smarticles101/cli that referenced this issue Feb 28, 2019
Smarticles101 added a commit to Smarticles101/cli that referenced this issue Mar 5, 2019
Smarticles101 added a commit to Smarticles101/cli that referenced this issue Oct 21, 2020
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

No branches or pull requests

2 participants