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: implement workspace command #413

Closed
kytrinyx opened this issue Aug 4, 2017 · 10 comments
Closed

nextercism: implement workspace command #413

kytrinyx opened this issue Aug 4, 2017 · 10 comments

Comments

@kytrinyx
Copy link
Member

kytrinyx commented Aug 4, 2017

To be merged into the nextercism branch in #410

Command name: workspace (alias w).
File: cmd/workspace.go.

This outputs the path to the user's workspace directory.

To get this value, load up a config.NewUserConfig(), which has a Workspace field.

@kytrinyx
Copy link
Member Author

kytrinyx commented Aug 4, 2017

@exercism/windows on Linux/MacOS you can say

cd `exercism workspace`

or

cd $(exercism workspace)

To change directory to the exercism workspace. How would you do this on Windows?

@NobbZ
Copy link
Member

NobbZ commented Aug 4, 2017

cmd.exe users won't have an alternative available. And as far as my google foo goes powershell should be able to use $() as well. I won't be able to confirm before Monday though.

@kytrinyx
Copy link
Member Author

kytrinyx commented Aug 4, 2017

Being able to give a Powershell command would be grand, thanks!

@rpottsoh
Copy link
Member

rpottsoh commented Aug 4, 2017

To change directory to the exercism workspace. How would you do this on Windows?

An environment variable may be used perhaps?

set WorkSpace="c:\my exercism workspace"

You may change to that directory like so in cmd:

cd %WorkSpace%

As far as PS goes I'm no expert. A quick search did yield this which I hope is helpful.

Is this sort of what you are asking?

@kytrinyx
Copy link
Member Author

kytrinyx commented Aug 4, 2017

Is this sort of what you are asking?

Yepp, something like that. The basic idea is to give people an easy way to get to their workspace, without having to type (or remember) long paths.

cd `exercism w`

An env variable is another way of doing this (as are aliases). I'm hoping to find a really nice and easy way to use the exercism w to let Windows users do the same thing.

@rpottsoh
Copy link
Member

rpottsoh commented Aug 4, 2017

So if I am understanding the intent of exercism w correctly it might look something like this:

C:\Program Files>
C:\Program Files> exercism w
C:\My Exercism Workspace>

Program Files might be the landing folder when cmd is executed.

@kytrinyx
Copy link
Member Author

kytrinyx commented Aug 4, 2017

@rpottsoh I don't think that is possible, since the command exercism w would be executed in a subshell. We'd need something to take the output of that command, and then change directory to it.

If this isn't a common idiom on Windows, then it might not be worth contorting ourselves to make it so :)

@NobbZ
Copy link
Member

NobbZ commented Aug 4, 2017

Its not a common idiom among windows users that still do not use powershell but stick to cmd.exe ;)

“Composition” of commands seems to be done in powershell quite often, though before googling around I've only seen piping.

For windows we will have at least one problem though. The working dir is per drive and shell session. So when we are on drive D: and the exercism workspace is on drive C: and we do cd $(exercism w), it will appear as if nothing happened, until one switches the drive manually… This behaviour fooled me quite often…

@robphoenix
Copy link
Contributor

On Powershell you can do cd $(exercism w), I couldn't get anything to work on cmd.exe.

@kytrinyx
Copy link
Member Author

Thanks for your help figuring out the Windows thing, everyone! I've documented with some caveats in the usage for the command.

Closed by #448

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

4 participants