jamesob / desk

A lightweight workspace manager for the shell
MIT License
2.54k stars 112 forks source link

Implement Deskfile recognition #55

Closed jamesob closed 8 years ago

jamesob commented 8 years ago

@rnewton @ianberinger @cmbankester @mblarsen @wricardo

(continuation of the ideas proposed in https://github.com/jamesob/desk/pull/53)

Add robust support for the Deskfile convention. Check the README changes for detailed information.

ianberinger commented 8 years ago

Code LGTM, this is a nice addition, but doesn't quite support my usecase: I just wanted a way to reference a desk in ~/.desk/desks/, as discussed in #42.

jamesob commented 8 years ago

@ianberinger to meet that use, you can just symlink ~/.desk/desks/whatever.sh to ./Deskfile.

ianberinger commented 8 years ago

Sure, but symlinking assumes that the desk is always stored in the same place. This isn't always the case across multiple systems and users. And for users using $DESK_DIR or $DESK_DESKS_DIR changing either of those would require renewing all symlinks.

Granted, this isn't a problem for me currently, as I have all my desks in the standard location on every system, but might be one for others.

jamesob commented 8 years ago

@ianberinger I'm not aware of multiple users making use of the same desk configurations, though. While maybe at some point there will be a good distribution mechanism for that, I'm not aware of one that exists. So as things stand now a path or symlink vs. a name shouldn't make a difference to most people (correct me if I'm wrong here).

Moreover, a Deskfile consisting of just a name doesn't do a project much good if they want to standardize somehow (a la Makefile) -- you'll have to distribute the desk configuration somehow too.

That said, if for some reason you really want the functionality you proposed in the original ticket, you can just have each Deskfile consist of something like

source $DESK_DESKS_DIR/my_desk.sh

Make sense?

Anyone else want to weigh in here?

cmbankester commented 8 years ago

Could we get some before/after images or gifs? I'm at work so I don't have a lot of time to try out the changes/review the code, but I'd certainly weigh in if I could see it in action.

ianberinger commented 8 years ago

@jamesob That's actually a great idea, thanks!

As I already said, this isn't currently an issue for me. I do believe that most users want to distribute a project-specific desk with the project itself (myself included) and think that this is the better solution for project-specific files. I just wanted to address this edge case :)

jamesob commented 8 years ago

@rnewton @mblarsen any thoughts here? Does this changeset meet your usecases?

jamesob commented 8 years ago

@ianberinger one snag with the source approach is that we'd have to modify desk to descend into whatever has been sourced for the basic static analysis we do to put together the index of aliases and commands. So maybe a .desk containing just the name could be done in addition to this notion of a Deskfile. Or maybe we start thinking about a comment directive that desk could use for extension... e.g.

# Extends: some_desk_name
...
jamesob commented 8 years ago

@cmbankester not much to show in a .gif; this just adds the ability to specify a directory-specific Deskfile.

mblarsen commented 8 years ago

@jamesob sorry for the late response. These are the Deskfiles I'm looking for :+1: Any outstanding issues on this PR?

jamesob commented 8 years ago

@mblarsen thanks for getting back. Let's ship it!