aboutsummaryrefslogtreecommitdiff
path: root/bin/menu-projects
blob: 6172bf24df21bedcd0647a156029de1d1f89a672 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/sh

# Looks only for directories with a git repo attached to it
project=$({ for p in $HOME/src/*/.git ;do
                basename `dirname $p`
            done } | bemenu -i -s -c -l 20 -W 0.5 -p 'Project:')

project_dir=$HOME/src/$project

if [ -z $project ] || [ ! -d $project_dir ]; then
    # Cancel selection or typo
    exit 1
fi

# cd into the project directory to load manifests, if available, and start Emacs from there
cd $project_dir
if [ -f manifest.scm ]; then
    guix shell -m manifest.scm -- emacs .
elif [ -f .manifest.scm ]; then
    guix shell -m .manifest.scm -- emacs .
else
    emacs .
fi