Update of /cvsroot/pure-data/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19188
Modified Files: config-switcher.sh Log Message: added --pdrc argument to switch between config file types
Index: config-switcher.sh =================================================================== RCS file: /cvsroot/pure-data/scripts/config-switcher.sh,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** config-switcher.sh 23 Jun 2005 18:43:53 -0000 1.2 --- config-switcher.sh 16 Oct 2005 00:19:21 -0000 1.3 *************** *** 7,18 **** print_usage() { echo "Usage: " ! echo "To select a config file:" ! echo " $0 select CONFIG_NAME" echo "To save the current config to file:" echo " $0 save CONFIG_NAME" echo "To delete the current config:" echo " $0 delete CONFIG_NAME" echo "To list existing configs:" echo " $0 list" exit } --- 7,27 ---- print_usage() { echo "Usage: " ! echo "To load a config file:" ! echo " $0 load CONFIG_NAME" ! echo " " echo "To save the current config to file:" echo " $0 save CONFIG_NAME" + echo " " echo "To delete the current config:" echo " $0 delete CONFIG_NAME" + echo " " echo "To list existing configs:" echo " $0 list" + echo " " + echo "To use the .pdrc instead, add '--pdrc':" + echo " $0 --pdrc load CONFIG_NAME" + echo " $0 --pdrc save CONFIG_NAME" + echo " $0 --pdrc delete CONFIG_NAME" + echo " $0 --pdrc list" exit } *************** *** 21,47 **** # THE PROGRAM
! # location of pref file that Pd reads ! case `uname` in ! Darwin) ! CONFIG_DIR=~/Library/Preferences ! CONFIG_FILE=org.puredata.pd.plist ! ;; ! *) CONFIG_DIR=~ CONFIG_FILE=.pdrc ! ;; ! esac ! ! # everything happens in this dir ! cd $CONFIG_DIR ! ! if [ $# -gt 1 ]; then ! save_file="$CONFIG_FILE-$2" ! case $1 in ! select) if [ -e "$save_file" ]; then test -e "$CONFIG_FILE" && mv "$CONFIG_FILE" /tmp ! ln -s "$save_file" "$CONFIG_FILE" && \ ! echo "Pd config "$save_file" selected." else echo ""$save_file" doesn't exist. No action taken." --- 30,73 ---- # THE PROGRAM
! if [ $# -eq 0 ]; then ! print_usage ! else ! # get the command line arguments ! if [ $1 == "--pdrc" ]; then CONFIG_DIR=~ CONFIG_FILE=.pdrc ! COMMAND=$2 ! CONFIG_NAME=$3 ! else ! COMMAND=$1 ! CONFIG_NAME=$2 ! # location of pref file that Pd reads ! case `uname` in ! Darwin) ! CONFIG_DIR=~/Library/Preferences ! CONFIG_FILE=org.puredata.pd.plist ! ;; ! Linux) ! CONFIG_DIR=~ ! CONFIG_FILE=.pdsettings ! ;; ! *) ! echo "Not supported on this platform." ! exit ! ;; ! esac ! fi ! ! # everything happens in this dir ! cd $CONFIG_DIR ! ! save_file="$CONFIG_DIR/$CONFIG_FILE-$CONFIG_NAME" ! case $COMMAND in ! load) if [ -e "$save_file" ]; then test -e "$CONFIG_FILE" && mv "$CONFIG_FILE" /tmp ! rm "$CONFIG_FILE" ! cp "$save_file" "$CONFIG_FILE" && \ ! echo "Pd config "$save_file" loaded." else echo ""$save_file" doesn't exist. No action taken." *************** *** 51,55 **** if [ -e "$CONFIG_DIR/$CONFIG_FILE" ]; then cp "$CONFIG_FILE" "$save_file" && \ ! echo "Pd config "$2" saved." else echo ""$CONFIG_FILE" doesn't exist. No action taken." --- 77,81 ---- if [ -e "$CONFIG_DIR/$CONFIG_FILE" ]; then cp "$CONFIG_FILE" "$save_file" && \ ! echo "Pd config "$CONFIG_NAME" saved." else echo ""$CONFIG_FILE" doesn't exist. No action taken." *************** *** 61,78 **** echo "Pd config "$save_file" deleted." else ! echo ""$CONFIG_FILE" doesn't exist. No action taken." fi ;; - *) print_usage ;; - esac - else - case $1 in list) echo "Available configs:" \ls -1 ${CONFIG_FILE}* ;; ! *) ! print_usage ! ;; esac fi --- 87,98 ---- echo "Pd config "$save_file" deleted." else ! echo ""$save_file" doesn't exist. No action taken." fi ;; list) echo "Available configs:" \ls -1 ${CONFIG_FILE}* ;; ! *) print_usage ;; esac fi