Code Monkey home page Code Monkey logo

desk's Introduction

◲ desk

build Join the chat at https://gitter.im/jamesob/desk

Lightweight workspace manager for the shell.

Desk makes it easy to flip back and forth between different project contexts in your favorite shell. Change directory, activate a virtualenv or rvm, load in domain-specific aliases, environment variables, functions, arbitrary shell files, all in a single command.

Instead of relying on CTRL-R to execute and recall ("that command's gotta be here somewhere..."), desk helps shorten and document those actions with shell aliases and functions, which are then namespaced under a particular desk.

Because Deskfiles are just enriched shell scripts, the possibilities are endless. For example, when doing work on AWS I have desk securely load AWS API keys into environment variables via pass -- no effort on my part, and no risk of accidentally persisting that sensitive information to a history file.

I have a hard time calling this a "workspace manager" with a straight face -- it's basically just a shell script that sources another shell script in a new shell. But I often find myself working in multiple different code trees simultaneously: the quick context switches and namespaced commands that desk facilitates have proven useful.

There are no dependencies other than bash. Desk is explicitly tested with bash, zsh, and fish.

◲  desk 0.6.0

Usage:

    desk
        List the current desk and any associated aliases. If no desk
        is being used, display available desks.
    desk init
        Initialize desk configuration.
    desk (list|ls)
        List all desks along with a description.
    desk (.|go) [<desk-name-or-path> [shell-args...]]
        Activate a desk. Extra arguments are passed onto shell. If called with
        no arguments, look for a Deskfile in the current directory. If not a
        recognized desk, try as a path to directory containing a Deskfile.
    desk run <desk-name> <cmd>
        Run a command within a desk's environment then exit. Think '$SHELL -c'.
    desk edit [desk-name]
        Edit (or create) a deskfile with the name specified, otherwise
        edit the active deskfile.
    desk help
        Show this text.
    desk version
        Show version information.

Since desk spawns a shell, to deactivate and "pop" out a desk, you
simply need to exit or otherwise end the current shell process.

For example, given this deskfile (~/.desk/desks/tf.sh):

# tf.sh
#
# Description: desk for doing work on a terraform-based repository
#

cd ~/terraform-repo

# Set up AWS env variables: <key id> <secret>
set_aws_env() {
  export AWS_ACCESS_KEY_ID="$1"
  export AWS_SECRET_ACCESS_KEY="$2"
}

# Run `terraform plan` with proper AWS var config
plan() {
  terraform plan -module-depth=-1 \
    -var "access_key=${AWS_ACCESS_KEY_ID}" \
    -var "secret_key=${AWS_SECRET_ACCESS_KEY}"
}

# Run `terraform apply` with proper AWS var config
alias apply='terraform apply'

we'd get

$ desk . tf
$ desk

tf
desk for doing work on a terraform repo

  set_aws_env   Set up AWS env variables: <key id> <secret>
  plan          Run `terraform plan` with proper AWS var config
  apply         Run `terraform apply` with proper AWS var config

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.

Installing

With homebrew

brew install desk

With curl

Assuming ~/bin exists and is on the PATH... otherwise, substitute /usr/local/bin and add sudo as needed.

  1. curl https://raw.githubusercontent.com/jamesob/desk/master/desk > ~/bin/desk
  2. chmod +x ~/bin/desk

With git

  1. git clone [email protected]:jamesob/desk.git && cd desk && sudo make install

After that, run desk init and start adding deskfiles with either desk edit [deskfile name] or by manually adding shell scripts into your deskfiles directory (by default ~/.desk/desks/).

Enabling shell extensions

NB: Shell extensions are automatically enabled if Desk is installed via Homebrew.

Using bash

  1. Add source /path/to/desk/repo/shell_plugins/bash/desk to your .bashrc.

Using fish

mkdir -p ~/.config/fish/completions
cp /path/to/desk/repo/shell_plugins/fish/desk.fish ~/.config/fish/completions

Using zsh

  1. Add fpath=(/path/to/desk/repo/shell_plugins/zsh $fpath) to your .zshrc.

Optionally, use one of the zsh plugin frameworks mentioned below.

Using oh-my-zsh

  1. make oh-my-zsh from within this repo. This sets up a symlink.

or

  1. cd ~/.oh-my-zsh/custom/plugins
  2. git clone [email protected]:jamesob/desk.git /tmp/desk && cp -r /tmp/desk/shell_plugins/zsh desk
  3. Add desk to your plugin list

Using Antigen

  1. Add antigen bundle jamesob/desk shell_plugins/zsh to your .zshrc
  2. Open a new terminal window. Antigen will clone the desk repo and add it to your path.

Using zgen

  1. Add zgen load jamesob/desk shell_plugins/zsh to your .zshrc with your other load commands
  2. rm ~/.zgen/init.zsh
  3. Start a new shell; zgen will generate a new init.zsh and automatically clone the desk repository for you and add it to your path.

Deskfile rules

Deskfiles are just shell scripts, nothing more, that live in the desk config directory. Desk does pay attention to certain kinds of comments, though.

  • description: you can describe a deskfile by including # Description: ... somewhere in the file.

  • alias and function docs: if the line above an alias or function is a comment, it will be used as documentation.

Deskfiles

Deskfiles are just shell scripts at the root of a project directory that adhere to the conventions above. These can be put into version control to formalize and ease common development tasks like running tests or doing local builds.

For example, if we have some directory or repository called myproject, if we create myproject/Deskfile, we'll be able to do any of the following:

$ desk go /path/to/myproject/
$ desk go /path/to/myproject/Deskfile
myproject/ $ desk go .
myproject/ $ desk go

Sharing deskfiles across computers

Of course, the desk config directory (by default ~/.desks) can be a symlink so that deskfiles can be stored in some centralized place, like Dropbox, and so shared across many computers.

Using a non-default config location

By default, desk configuration lives in ~/.desk ($DESK_DIR) and deskfiles live in ~/.desk/desks ($DESK_DESKS_DIR). If you want to use some other location, specify as much in desk init and then ensure you set $DESK_DIR and/or $DESK_DESKS_DIR to match in your shell's rc file.

Shortening invocation

Typing desk . frequently can get old; personally, I like to alias this with

alias d.='desk .'

in my shell rc file.

Usage with OS X

Desk won't work when used strictly with ~/.bash_profile on OS X's terminal, since the content of ~/.bash_profile is only executed on login, not shell creation, as explained here.

My recommendation is to use ~/.bashrc as your general-purpose config file, then simply have ~/.bash_profile point to it:

# ~/.bash_profile

if [ -f ~/.bashrc ]; then
   source ~/.bashrc
fi

Related projects

  • godesk by @hamin: a desk launcher with fuzzy filtering

Tips accepted

18ehgMUJBqKc2Eyi6WHiMwHFwA8kobYEhy

BTC: 18ehgMUJBqKc2Eyi6WHiMwHFwA8kobYEhy

Half of all tips will be donated to an organization providing aid to Syrian refugees.

Donations made on behalf of tippers

date amount organization
2015-11-18 $1.07 http://moas.eu
2016-11-14 $21.00 http://moas.eu

desk's People

Contributors

cfont avatar cgrinds avatar cmbankester avatar ericem avatar eush77 avatar groner avatar iammer avatar ianberinger avatar jamesob avatar jonashaag avatar magicant avatar mrmitch avatar ofsaleem avatar oxymor0n avatar rnewton avatar unixorn avatar wesselvdv avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

desk's Issues

Detect Fish on OSX when login shell is bash

On OSX, get_running_shell does not detect the calling process since it assumes a /proc filesytem.
That means when the running shell is fish, get_running_shell detects bash and things don't work.

Use of `sh -i` in desk run causes process suspension in pipelines

This makes desk unusable in some pipelines (or any pipelines if you don't like guessing).

This is a little complicated to reproduce. For instance, changing the first command from ls to seq 10 usually succeeds. I'm not sure what the reason is here, but it is likely related to the fact that seq can produce output sooner than ls.

:; desk run hello ls | desk run hello tac
[hangs]^C
[1]+  Stopped                 desk run hello ls | desk run hello tac
:; fg
desk run hello ls | desk run hello tac
[exits]

Or, if run with no controlling tty, we get warnings but the pipeline is otherwise functional.

:; desk run hello ls | desk run hello tac
bash: cannot set terminal process group (6214): Inappropriate ioctl for device
bash: no job control in this shell
bash: cannot set terminal process group (6211): Inappropriate ioctl for device
bash: no job control in this shell
[correct output follows]

I think this all has something to do with multiple shells trying to manage the foreground process on the terminal. This can be avoided if desk run stops using the -i flag and simply injects . $DESK_ENV; in front of the command to run.

Broken Bash Prompt with a weird fix

This might be unique to the way I'm using bash and local settings, but I have to use the following command to get my prompt back:

exec -l bash

Without this I 1) lose my pretty prompt, 2) get a weird error in tmux (using tmuxinator) that says bash: update_terminal_cwd: command not found.

I don't know why I need to do this and I don't know that anything needs to be fixed, but if there's a way to avoid this setting it might be good for future users of desk.

For reference my version of bash is and I'm on OSX Yosemite:

GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin14)
Copyright (C) 2007 Free Software Foundation, Inc.

support "logout" code

hey i have this desk that is connecting me to a VPN and does some more stuff,
it would be great if i could define some "teardown" or "logout" phase in my vpn.sh that is closing the VPN connecting and cleaning up.
similar to what .bash_logout would do.

command not found

I have installed desk from git and just pulled the latest version (0.3.2). Whenever i try to use desk go <desk_name>, i get the following error :

mitch@mitchbox desk go dash
/home/mitch/bin/desk: line 105: : command not found

I ❤️ DESK!

This isn't really an issue but more of a thank you @jamesob! I've been using desk for the past 2 years now mainly to manage env vars for different workspaces (among other things) across a polyglot development environment.

I really really love this tool. I love it so much that i have over 52 desk files on my work machine!

I'm a constant advocate to the other members on my team and have been able to convince at least some of them to try (all of whom have loved it).

I'd like to share a tool that I created to solve my own itch for managing my 50+ desk workspaces https://github.com/hamin/godesk . It's a dead simple, quickly hacked together launcher w/ fuzzy filtering that's been making my life easier and hopefully others here and yourself @jamesob will find it to be too :) . Here's a GIF of it in action

GIF

Please feel free to close this issue at your will :)

Hope you enjoy it to... and again... thank you!!!! ❤️

not really an issue -

without desk I would never be using many awesome CLI tools because I'd never remember the syntax. For example, transfer.sh. Maybe you could tell them that instead of telling people to use aliases, they could use desk !

desk fails to run when using warp terminal

Hi! I just found out desk today and I'm trying to set my different environments using desks files.

When I run the commands using the default macOS terminal, it runs as expected:

CleanShot 2023-02-27 at 17 08 25@2x

But when I try to use the terminal I currently use (https://www.warp.dev), it gives an error:

CleanShot 2023-02-27 at 17 09 17@2x

using a custom desks directory makes `desk` not work properly

I tried to use a custom dir to store my desks so that i can version it using git and push it to my git server, but desk behaves quite weirdly.

mitch@pc$ desk ls
No desk dir! Run 'desk init'.
mitch@pc$ ls /home/mitch/Workspace/desks/
dash.sh  rdcli.sh  symfony.sh  wp.sh
mitch@pc$ desk init
Desk dir already exists at /home/mitch/Workspace/desks

Assume desk name from current directory

It would be nice if desk would assume the name of the desk to load from the cwd if no desk name was given, e.g:

$ cd ~/myproject
$ desk .
$ desk

myproject
desk of my project
...

Desk is a lightweight module alternative!

Dear all,

this is not a issue-ticket, just a post to thank you for this great script and to make you conscious that you have created a very nice module load/unload lightweight-alternative!

I was frustrating with the cumbersome configuration of the unix command module and its modulefiles paths. I searched for a lightweight configuration-painless-alternative and I found your great desk.

You do not mention this application-case, but it is perfect for this. My workflow is now the following:

  • use desk to manage modulefile-like environment configuration: they are all into my home under the desks directory... easy to remember, easy to maintain;
  • use desk list like the old module avail to list the available modules;
  • use desk . desk-script like the old module load module-script to load the module;
  • use desk like old module list to list the loaded modules;
  • use exit like the old module unload module-script to revert back to the original shell.

This is a very awesome module replacement!

For example, the desk module file for loading gcc-6.0 environment is

# gcc-6.0.sh
#
# Description: load gcc 6.0 environment
#

PATH=/opt/arch/gcc/6.0/bin:$PATH
LD_LIBRARY_PATH=/opt/arch/gcc/6.0/lib/mpich:/opt/arch/gcc/6.0/lib:$LD_LIBRARY_PATH
LD_RUN_PATH=/opt/arch/gcc/6.0/lib/mpich:/opt/arch/gcc/6.0/lib:$LD_RUN_PATH
MANPATH=/opt/arch/gcc/6.0/share/man:$MANPATH
export PATH LD_LIBRARY_PATH LD_RUN_PATH MANPATH

Using deck as above described I obtain:

→ desk list
gcc-6.0 - load gcc 6.0 environment

→ desk . gcc-6.0

→ desk
gcc-6.0
load gcc 6.0 environment

→ gfortran --version

→ gfortran --version
GNU Fortran (GCC) 6.0.0 20151027 (experimental)
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

exit

→ gfortran --version
GNU Fortran (GCC) 5.2.0
Copyright (C) 2015 Free Software Foundation, Inc.

GNU Fortran comes with NO WARRANTY, to the extent permitted by law.
You may redistribute copies of GNU Fortran
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING

Very nice!

Thank you very much!

New installation instructions require assuming root

Hello,

Was wondering why you changed the installation instructions to use the curl method rather than the git clone + make method (especially with all that hard work I put into the Makefile QQ /s)

The reason I take issue with it is because (besides having to chmod +x it yourself)

curl https://raw.githubusercontent.com/jamesob/desk/master/desk > /usr/local/bin/desk

doesn't actually work unless you assume root. You can't just prepend sudo to that command since you're piping the output so you have to use either su or sudo su to become root and then use the curl command.

I'm assuming you changed it from git clone + make because it's easier to just download one file than mess with a whole directory. I get that, so I suggest changing it to either have sudo su at the top, or use:

sudo curl -o /usr/local/bin/desk https://raw.githubusercontent.com/jamesob/desk/master/desk
sudo chmod +x /usr/local/bin/desk

Again personally I think git clone + make is a tad bit easier/less annoying since you don't have to chmod the file but then you have to delete the directory so I guess it's up to you. Also the makefile installs to /usr/bin/desk and the curl command you list is /usr/local/bin/desk.

Sorry to nitpick so hard :P I want this baby in the AUR

IntelliJ (phpstorm) error on desk open.

I am getting the following error when trying to open a Deskfile in the terminal window of PhpStorm:

/usr/local/bin/desk: line 133: exec: jediterm-bash.in --bash -i: not found

Seems to be because the terminal plugin in Phpstorm is opening terminal sessions with additional flags which contain a path. This makes the approach chosen by desk to determine the shell interpreter impossible.

/bin/bash --rcfile /Users/wesselvdv/Library/Application Support/JetBrains/Toolbox/apps/PhpStorm/ch-0/182.3911.43/PhpStorm.app/Contents/plugins/terminal/jediterm-bash.in --login -i

cd on OS X has no effect(?)

Hi,

thanks for sharing the project; it sounds like a useful idea!

I installed desk 0.1.1 and put the following in ~/.desk/desks/app.sh:

# app.sh
# 
# Description: desk for doing work on my app
# 

cd /Users/michael/dev/app

desk list shows:

app - desk for doing work on my app

But the cd in my desk definition has no effect:

herrMBP:~ michael$ desk . app
bash-3.2$ pwd
/Users/michael

I would have expected the last line to read /Users/michael/dev/app (as per the cd command in my desk).

Am I doing something wrong?

Desk release v0.5.0

HI,

Thanks for creating Desk! I have installed via Homebrew and as v0.5.0 has not been released, I cannot upgrade via that channel. Any plans to release this update?

Thanks again!

Desk init does not work when using a custom location

This might be related to #34, somewhat, but considering the last activity on that thread was years ago, I instead decided to simply make another issue thread for this.

If I run desk init and set everything as default, everything works. However, if I try to set a different default location for .desk, it does not work and displays No desk dir! Run 'desk init'.

I'm not really doing anything fancy, so I don't really understand why it is not working. I'm sourcing the completions from the shell_plugins\bash\desk and I've set desk to an alias for ease of use. My bash version is 4.4.23(1)-release, as can be seen in the picture below.

image

The activation hook is added to the EOF in .bashrc, and I've even tried setting DESK_DIR and DESK_DESKS_DIR to their correct path and tested the output, I can cd to them just fine, but trying to run something like desk list immediately afterwards still makes it complain about No desk dir! Run 'desk init'.

Currently the environment variables are set to:

DESK_DIR='H:/.user/.desk'
DESK_DESKS_DIR='H:/.user/.desk/desks'

For clarity, it does not work even if the environment variables are not set.

When running something like desk go <deskname> it outputs this:

❯ desk go rtest
Desk rtest (rtest.sh) not found in /h//.desk/desks

So at least I know it is still checking in the default location, for some reason.

Testing with an absolute path results in the same.

❯ desk go /h/.user/.desk/desks/rtest
Desk /h/.user/.desk/desks/rtest (/h/.user/.desk/desks/rtest.sh) not found in /h//.desk/desks

Tab completions

Hey @jamesob, I mentioned I'd make a list of the things I've got planned for my wrapper that would fit in better upstream. First one is tab completing names of the deskfiles you have.

$ desk . som[Tab]
$ desk . some_desk_that_I_didnt_want_to_type_out

#62 broke desk within tmux

#62 broke desk when used within tmux. Running desk . <deskname> outside tmux works as expected. Running desk . <deskname> within tmux errors out with the following message:

/usr/local/bin/desk: line 133: 4744: command not found

Mr. jamesob, please fix your "desk" program.

➤ desk init
Where do you want to store your deskfiles? (default: /Users/robin/.desk): /Users/robin/.config/desk
/Users/robin/.config/desk doesn't exist, attempting to create.
Where's your shell rc file? (default: /Users/robin/.config/fish/config.fish):
Done. Start adding desks to /Users/robin/.config/desk/desks!

➤ desk
No desk activated.

No desk dir! Run 'desk init'.⏎

What??? But I just initialized a desk dir!

Load a desk without launching a new shell instance

It would be nice if there was a desk load or some such subcommand which would load a desk's script without leaving the current shell instance. This would be useful for allowing one to share some common desk setup among other desks. For instance, say I want to have some script setup some environment variables that will be common to other desks as well. Currently, as far as I can tell, the only way to do this is with something like:

# load the common code
. $(dirname $0)/common.sh

# start setting up the subdesk

when it would be much nicer just to be able to do something like:

# load the common code
desk load common

# start setting up the subdesk

`desk [name]` without the dot

Really like the idea and implementation, there's only that one thing with the dot when loading a desk.

I'm sure it's there for a reason, but is there a way to do a workaround for it not to be there, doing a desk [deskname] is so much more elegant than desk . [deskname].

desk doesn't seem to execute desk file at all

I found desk doesn't work in one of my new machine and I have no idea why this happens.

When I ran desk . ${desk}, a shell is launched but nothing specified in the desk script is executed.

➜  ~ desk ls
j
k
➜  ~ cat ~/.desk/desks/k.sh
cd /tmp
echo "hello"
➜  ~ ps aux | grep zsh
               8530   0.0  0.0  2461752   3744 s003  Ss+   6:04PM   0:00.48 -zsh
              82198   0.0  0.0  2452260   1996 s001  S+    4:24PM   0:00.00 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn zsh
              81932   0.0  0.0  2461752   4816 s001  S     4:24PM   0:00.44 -zsh
➜  ~ desk . k
➜  ~ ps aux | grep zsh
               8530   0.0  0.0  2461752   3744 s003  Ss+   6:04PM   0:00.48 -zsh
              82417   0.0  0.0  2460452   2004 s001  S+    4:24PM   0:00.00 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn zsh
              82204   0.0  0.0  2462228   4716 s001  S     4:24PM   0:00.17 zsh
              81932   0.0  0.0  2461752   4820 s001  S     4:24PM   0:00.45 -zsh

As you can see in the above:

  • desk k exists (shown by desk ls)
  • what desk k does is just changing a directory and prints "hello" (cat k.sh)
  • when running the desk script, neither the directory is changed nor the "hello" is output.
  • when viewing via "ps", you can see a new zsh shell is launched after running desk . k

Not sure if it is relevant, but when using desk run command, date seems to work as expected but echo still doesn't work as I expected and outputs only an empty line.

➜  ~ desk run k date
Tue May  9 16:27:49 CST 2017
➜  ~ desk run k echo "hello"

➜  ~

I am using:

  • macOS 10.12.4
  • desk 0.6.0 (installed via homebrew)
  • zsh & oh-my-zsh
  • it is the same behavior for both iterm2 and Terminal app under macOS

This is a similar issue as #70 but that issue was closed without any fix.
Could you please help? Thanks.

Release v0.5.0

As soon as we release v0.5.0 [1], I'll make a new PR to Homebrew updating the package and adding the Fish completion.

[1] Alternatively, we could release v0.4.1 instead, since the only change was the addition of completion for Fish, and the missing Fish completion could be seen as a bug meriting a patch-level release.

Give a way to add current desk in the zsh prompt

Hi !
Desk is great, but it would be even better if it's possible to show the current desk into the zsh (for instance) prompt, in order to know where we are.

I see in the demo gif in the readme that you have a "(venv)" prepending your prompt, is there anyway to have the something but with the name of the current desk ?

autoreload desk on save.

Hello
Thanks for desk it's really clever and useful
I think it will be nice to add a trigger when we edit a desk from inside (desk edit) to exit and reload the desk.

Great script!

Functions Printing Ugly

Using desk on OSX 10.10 (bash) the layout of the output from the desk command inside a desk doesn't match the gif in the README. Instead of just the name of the function and the description like foo - description of foo I get the parentheses after the name and then also get a new line with an opening curly brace. Using the plan function from one of your examples, I get this:

plan() - Run `terraform plan` with proper AWS var config
  {

Any thoughts on if this is a local issue or part of the project?

`get_running_shell` picks not-a-shell sometimes

Running strace desk run hello something leads to desk deciding my shell is strace, so it invokes strace -ic something. This actually runs something, but without the requested desk environment and a confusing strace warning and output.

Add tag for github release

Hi @jamesob ,

thanks for your work, this is cool!

I want to submit a formula to homebrew, but found it requires version number in download url.

currently we can access tarball via https://github.com/jamesob/desk/archive/master.tar.gz.
and if we have a release, we can access tarball via https://github.com/jamesob/desk/releases/download/1.0/desk-1.0.tar.gz

Could you add tag (and github release)?

Using desk name in PS1

I've had a go at trying to get the name of the current desk into the prompt, but I'm having trouble doing so. It would be nice if there was a $DESK_NAME variable that could be used in the prompt, the same as python venvs.

Prevent nested session

I mentioned this in a comment on #67, but I think nested sessions should be prevented. For example, if I run desk . project-one then try to run desk . project-two, desk should ask if I want to leave the first session to enter the next or prevent me from nesting at all.

Display description of exported environment variables along with aliases and functions

I think it would be useful if I could do something like that in a desk file:

# Description: my desk to work on things.

# Do something.
alias mycommand="foo"

# My environment variable.
export MYVAR="something"

And then when typing desk with the desk activated it would show the description of $MYVAR:

mydesk - my desk to work on things.

  mycommand  Do something.

Environment variables:

$MYVAR  My environment variable.

Ability to run a clean up script when exiting a desk session

It would be great if there was a way to run a script when using the exit command to leave a desk session. For instance I have a desk session setup when I am working on some specific github repos for work and sometimes I forgot to run the git add and commit commands before leaving my desk session. Not really a huge deal as I can still run them from a normal shell, but would be useful to run a cleanup script upon exit.

is there a way to start new terminal session with previous used desk session?

When I switch to a desk and then create a new terminal window, eg urxvt, I would love to have this use the same desk. This could be similarly accomplished as we do it with resuming on the same path.

I'm just wondering if anyone is doing this already and could point me in the right direction.

What would also be interesting is to start urxvt in a specific desk mode.

thanks!

Build from repository

Just for the sake of context: I'm building a bit of a wrapper project around this that will handle auto-configuration of projects. My workflow, in general, is to

  1. Do a clean checkout of the repo I'm currently working on
  2. Create a branch to hold my feature/bug
  3. Initialize the project (we use ant)
  4. Watch for the directory for changes and rsync to a remote server (sometimes)
  5. Do some configuration (vhosts) on that same remote server (sometimes)
  6. Finish my work and commit, push.
  7. Wait for testers to be done and then delete everything.

While the majority of that doesn't fit in with the philosophy of desk and is really specific to my workflow, the bit about checking out from a repository might be. I'm envisioning something like

$ desk build github.com/owner/repo [desk-name]

Where you would previously configure where you want the projects to live (like configuring where you want the deskfiles to live).

This would create some stub deskfile (desk-name.sh) and do the git clone in your project directory.

The biggest things that I'd see with this are:

  1. Tying desk to a specific scm (git) or host (github) OR trying to generalize and really bloating the code
  2. Requiring an additional template file that would need to live somewhere and have a reference
  3. Requiring users to configure and create a project directory

Maybe not ideal as laid out here, but potentially could be hammered into something useful 😄 I'd like to hear your thoughts on this, @jamesob.

Description of aliases and functions are being duplicated

Desired behaviour

When I create the following alias inside a desk:

# Tmux shortcut
alias t="tmux"

And add, to the same desk, the following function:

# Do something cool
function tns() {
   ...
}

I would to receive the following output when type desk (with the desk loaded)

global - Common shared configurations

  t     Tmux shortcut
  tns   Do something cool

Actual behaviour

When I do that, I receive:

global - Common shared configurations

  t     Tmux shortcut
# Do something cool Do something cool
  tns   Do something cool

Aditional info

I've noticed that this only happens with aliases that has a high similarity with functions.

For example, I have a k alias and a kl alias. This won't happen. But if I have a k alias and a kl function this happens.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.