-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
31 additions
and
2 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/bin/bash | ||
# Strip out non essential entries from a config file. | ||
# This is used to help you focus when deriving a new gestureLayout from and old one. It also makes sure that what you set gets loaded in the way that you expect. | ||
# The entries that are stripped out are everything that is not "value". | ||
# | ||
# Syntax: | ||
# $0 "fileName.yml" | ||
|
||
function showHelp | ||
{ | ||
echo >&2 | ||
grep -B1000 '^function showHelp$' "$0" | grep '^# ' | sed 's/^# //g;s#\$0#'"$0"'#g' >&2 | ||
exit 1 | ||
} | ||
|
||
if [ "$1" == "" ]; then | ||
echo "You need to specify a filename." >&2 | ||
showHelp | ||
elif [ ! -e "$1" ]; then | ||
echo "The file \"$1\" doesn't appear to exist." >&2 | ||
showHelp | ||
fi | ||
|
||
fileName="$1" | ||
temporaryFileName="$fileName.cleaned" | ||
|
||
grep '\(:$\|^ *\(value: \|groups\)\)' "$fileName" > "$temporaryFileName" | ||
diff "$temporaryFileName" "$fileName" | ||
mv "$temporaryFileName" "$fileName" |
File renamed without changes.
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