Skip to content

Commit

Permalink
Add more usage info. Add tweakable destination prefix.
Browse files Browse the repository at this point in the history
  • Loading branch information
sbakker committed Nov 30, 2017
1 parent 8ad6e3a commit e1f8d3b
Showing 1 changed file with 26 additions and 5 deletions.
31 changes: 26 additions & 5 deletions convert_solarized.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
# Usage:
#
# convert_solarized.sh [colors-dir]
# convert_solarized.sh [colors-dir [dest-prefix]]
#
# Default "colors-dir" is "gnome-terminal-colors-solarized/colors"
#
Expand All @@ -17,10 +17,31 @@
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

topdir=gnome-terminal-colors-solarized/colors
destprefix=solarized-

usage() {
cat <<EOF >&2
Usage: $0 [colors-dir [dest-prefix]]
default colors-dir is $topdir
default dest-prefix is \"$destprefix\"
YAML files are left in "color/\${destprefix}PROFILE/colors.yaml"
EOF
exit 1
}

case $# in
0) topdir=gnome-terminal-colors-solarized/colors ;;
1) topdir=$1 ;;
*) echo "usage: $0 [colors-dir]" >&2; exit 1 ;;
0) ;;
1) topdir=$1
;;
2) topdir=$1
destprefix=$2
;;
*) usage
;;
esac

currdir=$(pwd)
Expand All @@ -30,7 +51,7 @@ cd $topdir
for dir in *
do
if [[ -d $dir && -f $dir/palette ]]; then
dest=$currdir/colors/solarized-$base
dest=$currdir/colors/$destprefix$dir
mkdir -p $dest
echo "converting $topdir/$dir"
$currdir/src/theme_to_yaml.pl $dir > $dest/colors.yaml
Expand Down

0 comments on commit e1f8d3b

Please sign in to comment.