Created
February 27, 2012 00:52
-
-
Save dvoiss/1920206 to your computer and use it in GitHub Desktop.
Quick bare .project file for a directory or list of directories for importation into Eclipse as stand alone "project"...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# generates an empty .project file with just the name of the directory | |
# being used as the project name | |
# USAGE: | |
if [ "$1" = "-h" -o "$1" = "--help" ]; then | |
echo; echo "Usage: $0 [options]" | |
echo; echo "== Options" | |
echo; echo -e "Pass the string \"sub\" to generate empty .project files for \ | |
sub-directories of this directory." | |
exit 0 | |
fi | |
# writes the project file | |
write_project_file() { | |
project_xml="$(cat<<EOF | |
<projectDescription> | |
\n\t<name> | |
\n\t\t$1 | |
\n\t</name> | |
\n</projectDescription> | |
EOF | |
)" | |
echo $project_xml > .project | |
} | |
if [ "$1" = "sub" ]; then | |
# go through sub-directories creating .project files for each, | |
# this is of little use, but it's here just 'cause :) | |
for i in *; do | |
[[ -d "$i" ]] && { | |
cd "$i" | |
write_project_file "$i" | |
cd .. | |
} | |
done | |
else | |
# only write .project file for current directory: | |
# ${PWD##*/} gets current directory name (not full path) | |
write_project_file "${PWD##*/}" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment