Skip to content

Commit

Permalink
cmd: remove deprecated --preserve-links and add --preserve=all as opt…
Browse files Browse the repository at this point in the history
…ion, see #562
  • Loading branch information
tdewolff committed Jun 17, 2023
1 parent 6622a33 commit c9ecb52
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion cmd/minify/bash_completion
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ _minify_complete() {
local cur prev flags mimes types
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
flags="-a --all --bundle --cpuprofile --exclude --include -l --list --match --memprofile --mime -o --output -p --preserve --preserve-links -q --quiet -r --recursive --type --url -v --verbose --version -w --watch --css-precision --html-keep-comments --html-keep-conditional-comments --html-keep-default-attrvals --html-keep-document-tags --html-keep-end-tags --html-keep-quotes --html-keep-whitespace --js-precision --js-keep-var-names --js-version --json-precision --json-keep-numbers --svg-keep-comments --svg-precision -s --sync --xml-keep-whitespace"
flags="-a --all --bundle --cpuprofile --exclude --include -l --list --match --memprofile --mime -o --output -p --preserve -q --quiet -r --recursive --type --url -v --verbose --version -w --watch --css-precision --html-keep-comments --html-keep-conditional-comments --html-keep-default-attrvals --html-keep-document-tags --html-keep-end-tags --html-keep-quotes --html-keep-whitespace --js-precision --js-keep-var-names --js-version --json-precision --json-keep-numbers --svg-keep-comments --svg-precision -s --sync --xml-keep-whitespace"
mimes="text/css text/html text/javascript application/javascript application/json image/svg+xml text/xml application/xml"
types="css html js json svg xml"

Expand Down
12 changes: 6 additions & 6 deletions cmd/minify/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,8 @@ func run() int {
f.CountVarP(&verbose, "verbose", "v", "Verbose mode, set twice for more verbosity")
f.BoolVarP(&watch, "watch", "w", false, "Watch files and minify upon changes")
f.BoolVarP(&sync, "sync", "s", false, "Copy all files to destination directory and minify when filetype matches")
f.StringSliceVarP(&preserve, "preserve", "p", nil, "Preserve options (mode, ownership, timestamps, links)")
f.StringSliceVarP(&preserve, "preserve", "p", nil, "Preserve options (mode, ownership, timestamps, links, all)")
f.Lookup("preserve").NoOptDefVal = "mode,ownership,timestamps"
f.BoolVar(&preserveLinks, "preserve-links", false, "Copy symbolic links without dereferencing and without minifying the referenced file (only with --sync)")
f.BoolVarP(&bundle, "bundle", "b", false, "Bundle files by concatenation into a single file")
f.BoolVar(&version, "version", false, "Version")

Expand Down Expand Up @@ -207,10 +206,6 @@ func run() int {
}
}

if preserveLinks {
Warning.Println(fmt.Errorf("--preserveLinks is deprecated, use --preserve=links instead"))
}

if help {
f.Usage()
return 0
Expand Down Expand Up @@ -331,6 +326,11 @@ func run() int {
}
for _, option := range preserve {
switch option {
case "all":
preserveMode = true
preserveOwnership = true
preserveTimestamps = true
preserveLinks = true
case "mode":
preserveMode = true
case "ownership":
Expand Down

0 comments on commit c9ecb52

Please sign in to comment.