Giter Club home page Giter Club logo

desk's Issues

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

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!

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.

`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.

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 !

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

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!

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

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.

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!!!! ❤️

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

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!

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.

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!

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.

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 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

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?

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.

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.

#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

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.

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.

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.

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

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?

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 ?

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!

`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].

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

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)?

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.

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

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.

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.

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.