mirror of
https://github.com/arkenfox/user.js.git
synced 2025-05-03 23:43:40 +02:00
remove comment regex
This commit is contained in:
parent
f3e2bfa76d
commit
c3c6308c3c
1 changed files with 6 additions and 2 deletions
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
## ghacks-user.js updater for macOS and Linux
|
## ghacks-user.js updater for macOS and Linux
|
||||||
|
|
||||||
## version: 2.1
|
## version: 2.2
|
||||||
## Author: Pat Johnson (@overdodactyl)
|
## Author: Pat Johnson (@overdodactyl)
|
||||||
## Additional contributors: @earthlng, @ema-pe
|
## Additional contributors: @earthlng, @ema-pe
|
||||||
|
|
||||||
|
@ -260,7 +260,11 @@ add_override () {
|
||||||
}
|
}
|
||||||
|
|
||||||
remove_comments () { # expects 2 arguments: from-file and to-file
|
remove_comments () { # expects 2 arguments: from-file and to-file
|
||||||
sed -e 's/^[[:space:]]*\/\/.*$//' -e '/^\/\*/,/\*\//d' -e '/^[[:space:]]*$/d' -e 's/);[[:space:]]*\/\/.*/);/' "$1" > "$2"
|
sed -e 's/^[[:space:]]*\/\/.*$//' "$1" | #single line comments
|
||||||
|
sed -e '/^\/\*/,/\*\//d' | #multi line comments
|
||||||
|
sed -e '/^[[:space:]]*$/d' | #empty lines
|
||||||
|
sed -e 's/);[[:space:]]*\/\/.*/);/' | #end of line comments
|
||||||
|
tr -s '[:space:]' > "$2" #trime white spaces
|
||||||
}
|
}
|
||||||
|
|
||||||
# Applies latest version of user.js and any custom overrides
|
# Applies latest version of user.js and any custom overrides
|
||||||
|
|
Loading…
Add table
Reference in a new issue