On Thu, Jul 24, 2008 at 7:40 AM, Puneet Lakhina puneet.lakhina@gmail.com wrote:
I was wondering if something similar for the shell would be useful. It could for example alter the history to only have the commands that you used in the context of working on a paritcular task. It could maybe even set up env accordingly.
I don't know how much this satisfies your requirements, but I do something on the following lines (And given your exposure to mylyn, you can think of expanding this further - my requirements, and hence the solution, are simple):
I create various "contexts" and set my env-variables to specific values for a given context. Let's say, I have contexts A and B to work in, and I have corresponding directories A and B in my $HOME. Then I define functions in my shell which set up some variables based on the context I am requesting ($HOME, $PATH, $CVSROOT, $HISTFILE, $PS1 etc.) - and have a 'revert' function (I call 'b2n' - back-2-normal) which resets all variables to the original ones).
Nothing sophisticated, but works for me!
(The following goes into your shell's config file) <script-snippet> if [ -z "$OLDHOME" ]; then export OLDHOME=$HOME fi if [ -z "$OLDPATH" ]; then export OLDPATH=$PATH fi if [ -z "$OLDLD_LIBRARY_PATH" ]; then export OLDLD_LIBRARY_PATH=$LD_LIBRARY_PATH fi if [ -z "$OLDCVSROOT" ]; then export OLDCVSROOT=$CVSROOT fi if [ -z "$OLDPS1" ]; then export OLDPS1=$PS1 fi if [ -z "$OLDPKG_CONFIG_PATH" ]; then export OLDPKG_CONFIG_PATH=$PKG_CONFIG_PATH fi if [ -z "$OLDCLASSPATH" ]; then export OLDCLASSPATH=$CLASSPATH fi
b2n () { export HOME=$OLDHOME export PATH=$OLDPATH export LD_LIBRARY_PATH=$OLDLD_LIBRARY_PATH export CVSROOT=$OLDCVSROOT export PS1=$OLDPS1 export PKG_CONFIG_PATH=$OLDPKG_CONFIG_PATH export CLASSPATH=$OLDCLASSPATH cd }
contextA() { export HOME=$OLDHOME/A .... cd } </script-snippet>
HTH.