#!/usr/bin/env bash
########################################################################
# Copyright 2014 Lukas Bestle <project-projectr@lukasbestle.com>
# License   MIT
########################################################################
# Lists all known project directories.
#
# Usage: project_list
########################################################################

# Determine the path to the projects file
configPath=${XDG_CONFIG_HOME:-$HOME/.config}
if [[ -d "$configPath/projectr" ]]; then
	projectsFile="$configPath/projectr/projects"
else
	projectsFile="$HOME/.projects"
fi

# Check if the projects file exists
if [[ ! -f "$projectsFile" ]]; then
	echo -e "\033[31mThere is no \033[34m$projectsFile\033[31m file yet.\033[0m" >&2
	exit 1
fi

cat "$projectsFile"
exit $?
