mottosso / be

minimal directory and environment management system for collaborative creative projects
GNU Lesser General Public License v2.1
47 stars 4 forks source link

be home #11

Closed mottosso closed 9 years ago

mottosso commented 9 years ago

goal

To cd into the development directory of the current topic.

implementation

To have be, which is a Python application, change the current directory of it’s parent process, in this case bash. One alternative is to make be the base command into a command-line script, and have each subcommand routed to the Python program, except command-line specific commands such as home, which is treated by the shell script directly.

$ be # bash
$ be new ad  # Python
$ be home # bash

Here's an example be.bat to replace the default Python callable.

@echo off

if "%1" == "home" (
  cd %BE_DEVELOPMENTDIR%

) else python -m be %*

In this case, all commands that is not home is routed to Python, whereas home is handled by cmd.exe.

problem

The apparent problem is that we can now no longer rely on pip to install this executable for us, complicating deployment and thereafter adoption. I.e. users can't simply run pip install and get with it, they will not have to manually create and shuffle around files.

We can work around it by creating a dedicated installed, but then again we loose the advantage of pip being familiar and thus eases adoption.

mottosso commented 9 years ago

Implemented in 0.2 as simply home.

$ be in hulk bruce rigging
$ home

On Unix, the command will have to be sourced.

$ be in hulk bruce rigging
$ . home