diff --git a/README.md b/README.md index f86ec17..bf21e3f 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ There are no dependencies other than `bash`. Desk is explicitly tested with `bas `zsh`, and `fish`. ```sh -◲ desk 0.3.2 +◲ desk 0.4.0 Usage: @@ -40,6 +40,7 @@ Usage: List all desks along with a description. desk (.|go) [shell-args...] Activate a desk. Extra arguments are passed onto shell. + Without a name specified, it tries activating the desk specified in the ./.desk file. desk run Run a command within a desk's environment then exit. Think '$SHELL -c'. desk edit [desk-name] @@ -97,7 +98,7 @@ desk for doing work on a terraform repo Basically, desk just associates a shell script (`name.sh`) with a name. When you call `desk . name`, desk drops you into a shell where `name.sh` has been executed, and then desk extracts out certain comments in `name.sh` for useful -rendering. +rendering. If you call `desk .` without any desk specified, desk will look for a .desk file in the current directory and uses its content as the name. ### Installing diff --git a/desk b/desk index 781612d..6ba64f5 100755 --- a/desk +++ b/desk @@ -27,6 +27,7 @@ Usage: List all desks along with a description. $PROGRAM (.|go) [shell-args...] Activate a desk. Extra arguments are passed onto shell. + Without a name specified, it tries activating the desk specified in the ./.desk file. $PROGRAM run Run a command within a desk's environment then exit. Think '\$SHELL -c'. $PROGRAM edit [desk-name] @@ -91,6 +92,11 @@ cmd_init() { cmd_go() { local TODESK="$1" + if [ -z "$TODESK" -a -f "${PWD}/.desk" ]; then + # if no desk is specified try the .desk file in the current directory + read TODESK < "${PWD}/.desk" + fi + local DESKEXT=$(get_deskfile_extension) local DESKPATH="$(find "${DESKS}/" -name "${TODESK}${DESKEXT}")"