the-xkcd-community/the-red-spider-project — pull request #21 by jgonggrijp (2013-03-24 22:51:32+00:00)
Title: rsshell "teleports" to ROOT/work; needs testing on Linux and Windows

`rsshell` now sets the working directory to `$RED_SPIDER_ROOT/work`, creating the subdirectory if it doesn't exist yet. This makes sense, and is convenient, because

* the name of the directory ("work") was chosen both to indicate it's the place where commands are supposed to "do their work" and to suggest that users make it their working directory;
* the user likely wants to be there, given that e.g. `xkcd-fetch` stores its comic cache within `/work`;
* it only takes `cd ..` to get to the project root, where hackers interact with Git, and it's very close to all the project contents (such as the Readme and the source files).

Upon `exit`, `rsshell` resets the working directory to the one prior to invocation.

In the future both behaviours, i.e. the target directory upon invocation and the reset directory upon exit, could be made customizable with command-line arguments, configuration files or both.

In addition the introduction message has been made more informative.

Before the changes can be merged the following needs to be tested.

On Linux:

```
1. cd $RED_SPIDER_ROOT

2. # if you didn't already have me:
git remote add julian git://github.com/jgonggrijp/the-red-spider-project.git

3. git fetch julian
git checkout julian/rsshell-workdir
./setup.py
# follow the instructions, say "yes" when it asks whether you want to install

4. # if one of the below commands yields an empty string,
# log out of your computer and log back in
echo $RED_SPIDER_ROOT
which rsshell
# the latter should be $RED_SPIDER_ROOT/extbin/rsshell

5. cd /very/far/away # preferably a subdirectory of a different volume
rsshell
# you should get an introduction message with four parts:
# "Welcome ...", "RED_SPIDER_ROOT = ...", "... teleported ...", "... exit ..."
# and then see the shell prompt.

6. pwd
# should confirm that you're indeed in $RED_SPIDER_ROOT/work

7. exit
pwd
# you should now be back in /very/far/away from step 5

8. cd $RED_SPIDER_ROOT
rsshell bin/xkcd-fetch -l
# should produce the metadata of the latest comic
```

On Windows:

```

1. cd %RED_SPIDER_ROOT%

2. # if you didn't already have me:
git remote add julian git://github.com/jgonggrijp/the-red-spider-project.git

3. git fetch julian
git checkout julian/rsshell-workdir
setup.py
# follow the instructions, say "yes" when it asks whether you want to install

4. # if one of the below commands doesn't produce a concrete path,
# log out of your computer and log back in
echo %RED_SPIDER_ROOT%
where rsshell
# the latter should be %RED_SPIDER_ROOT%\extbin\rsshell

5. cd /d x:\very\far\away # preferably a subdirectory of a different drive
# leave out the /d switch if there's no other drive
rsshell
# you should get an introduction message with four parts:
# "Welcome ...", "RED_SPIDER_ROOT = ...", "... teleported ...", "... exit ..."
# and then see the cmd prompt.

6. echo %cd%
# should confirm that you're indeed in %RED_SPIDER_ROOT%\work

7. exit
echo %cd%
# you should now be back in x:\very\far\away from step 5

8. cd %RED_SPIDER_ROOT%
rsshell bin\xkcd-fetch -l
# should produce the metadata of the latest comic
```