github.com/ryanbennettvoid/go-swagger@v0.18.1-0.20190104015444-3854bbbe2392/hack/add-license.sh (about)

     1  #!/bin/zsh
     2  setopt extended_glob
     3  echo '
     4  // Copyright 2018 go-swagger maintainers
     5  //
     6  // Licensed under the Apache License, Version 2.0 (the "License");
     7  // you may not use this file except in compliance with the License.
     8  // You may obtain a copy of the License at
     9  //
    10  //    http://www.apache.org/licenses/LICENSE-2.0
    11  //
    12  // Unless required by applicable law or agreed to in writing, software
    13  // distributed under the License is distributed on an "AS IS" BASIS,
    14  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    15  // See the License for the specific language governing permissions and
    16  // limitations under the License.
    17  ' > /tmp/copyright.txt
    18  
    19  for i in (^vendor/)#*.go # or whatever other pattern...
    20  do
    21    if ! grep -q Copyright $i
    22    then
    23      echo "cat /tmp/copyright.txt $i >$i.new && mv $i.new $i"
    24    fi
    25  done
    26  
    27  rm /tmp/copyright.txt