3 # generates alias files for different operating systems and shell scripts.
4 # or really, mainly for bash these days, on linux. but we also run under
5 # msys and cygwin to some degree.
7 # The "common.alias" file is used in the generated aliases file as a base
8 # set of generally useful aliases. Shorter aliases based on any scripts
9 # we can find in the feisty meow script hierarchy are added in as well.
11 # If any other alias files are found in the scripts/custom folder, they
12 # are pulled in as additions and overrides for the basic feisty meow command
15 if [ ! -z "$SHELL_DEBUG" ]; then echo rebuiling generated aliases file...; fi
17 # create our generated shells directory if it's not already.
18 if [ ! -d $FEISTY_MEOW_GENERATED ]; then mkdir $FEISTY_MEOW_GENERATED; fi
20 # test if we can use color in ls...
21 test_color=$(ls --help 2>&1 | grep -i color)
23 ALIAS_DEFINITION_FILES=("$FEISTY_MEOW_SCRIPTS/core/common.alias")
24 # if custom aliases files exist, add them to the list.
25 for i in "$FEISTY_MEOW_SCRIPTS/custom/*.alias"; do
27 ALIAS_DEFINITION_FILES+=("$i")
30 for i in "${ALIAS_DEFINITION_FILES[@]}"; do
31 echo " $(basename $(dirname $i))/$(basename $i)"
34 # write the aliases for sh and bash scripts.
36 GENERATED_ALIAS_FILE="$FEISTY_MEOW_GENERATED/aliases.sh"
37 echo "writing $GENERATED_ALIAS_FILE..."
39 #hmmm: perhaps a good place for a function to create the header,
40 # given the appropriate comment code.
42 echo "##" >$GENERATED_ALIAS_FILE
43 echo "## generated file: $GENERATED_ALIAS_FILE" >>$GENERATED_ALIAS_FILE
44 echo "## please do not edit." >>$GENERATED_ALIAS_FILE
45 echo "##" >>$GENERATED_ALIAS_FILE
47 if [ ! -z "$test_color" ]; then
48 echo "color_add=--color=auto" >>$GENERATED_ALIAS_FILE
50 echo "color_add=" >>$GENERATED_ALIAS_FILE
53 # plow in the full set of aliases into the file.
54 for i in "${ALIAS_DEFINITION_FILES[@]}"; do
55 cat $i >>$GENERATED_ALIAS_FILE
58 if [ ! -z "$SHELL_DEBUG" ]; then echo done rebuiling generated aliases file.; fi