diff --git a/_example/barchart.go b/_example/barchart.go index 6a94091..b3c57be 100644 --- a/_example/barchart.go +++ b/_example/barchart.go @@ -1,4 +1,4 @@ -// Copyright 2016 Zack Guo . All rights reserved. +// Copyright 2016 Zack Guo . All rights reserved. // Use of this source code is governed by a MIT license that can // be found in the LICENSE file. diff --git a/_example/dashboard.go b/_example/dashboard.go index 95a23e9..2205d5e 100644 --- a/_example/dashboard.go +++ b/_example/dashboard.go @@ -1,4 +1,4 @@ -// Copyright 2016 Zack Guo . All rights reserved. +// Copyright 2016 Zack Guo . All rights reserved. // Use of this source code is governed by a MIT license that can // be found in the LICENSE file. diff --git a/_example/gauge.go b/_example/gauge.go index dcce7b0..22994ce 100644 --- a/_example/gauge.go +++ b/_example/gauge.go @@ -1,4 +1,4 @@ -// Copyright 2016 Zack Guo . All rights reserved. +// Copyright 2016 Zack Guo . All rights reserved. // Use of this source code is governed by a MIT license that can // be found in the LICENSE file. diff --git a/_example/grid.go b/_example/grid.go index f05fa42..58ef8ec 100644 --- a/_example/grid.go +++ b/_example/grid.go @@ -1,4 +1,4 @@ -// Copyright 2016 Zack Guo . All rights reserved. +// Copyright 2016 Zack Guo . All rights reserved. // Use of this source code is governed by a MIT license that can // be found in the LICENSE file. diff --git a/_example/linechart.go b/_example/linechart.go index 68573c8..9e45700 100644 --- a/_example/linechart.go +++ b/_example/linechart.go @@ -1,4 +1,4 @@ -// Copyright 2016 Zack Guo . All rights reserved. +// Copyright 2016 Zack Guo . All rights reserved. // Use of this source code is governed by a MIT license that can // be found in the LICENSE file. diff --git a/_example/list.go b/_example/list.go index 2520b98..1db4f08 100644 --- a/_example/list.go +++ b/_example/list.go @@ -1,4 +1,4 @@ -// Copyright 2016 Zack Guo . All rights reserved. +// Copyright 2016 Zack Guo . All rights reserved. // Use of this source code is governed by a MIT license that can // be found in the LICENSE file. diff --git a/_example/mbarchart.go b/_example/mbarchart.go index c65fc59..751d57b 100644 --- a/_example/mbarchart.go +++ b/_example/mbarchart.go @@ -1,4 +1,4 @@ -// Copyright 2016 Zack Guo . All rights reserved. +// Copyright 2016 Zack Guo . All rights reserved. // Use of this source code is governed by a MIT license that can // be found in the LICENSE file. diff --git a/_example/par.go b/_example/par.go index 827b31b..1e11535 100644 --- a/_example/par.go +++ b/_example/par.go @@ -1,4 +1,4 @@ -// Copyright 2016 Zack Guo . All rights reserved. +// Copyright 2016 Zack Guo . All rights reserved. // Use of this source code is governed by a MIT license that can // be found in the LICENSE file. diff --git a/_example/sparklines.go b/_example/sparklines.go index dc486f4..d7852e2 100644 --- a/_example/sparklines.go +++ b/_example/sparklines.go @@ -1,4 +1,4 @@ -// Copyright 2016 Zack Guo . All rights reserved. +// Copyright 2016 Zack Guo . All rights reserved. // Use of this source code is governed by a MIT license that can // be found in the LICENSE file. diff --git a/_example/tabs.go b/_example/tabs.go index 3d5d00e..1ed4a62 100644 --- a/_example/tabs.go +++ b/_example/tabs.go @@ -1,4 +1,4 @@ -// Copyright 2016 Zack Guo . All rights reserved. +// Copyright 2016 Zack Guo . All rights reserved. // Use of this source code is governed by a MIT license that can // be found in the LICENSE file. diff --git a/_example/theme.go b/_example/theme.go index 8cc565e..e80264f 100644 --- a/_example/theme.go +++ b/_example/theme.go @@ -1,4 +1,4 @@ -// Copyright 2016 Zack Guo . All rights reserved. +// Copyright 2016 Zack Guo . All rights reserved. // Use of this source code is governed by a MIT license that can // be found in the LICENSE file. diff --git a/_example/ttop.go b/_example/ttop.go index d139f79..feb892e 100644 --- a/_example/ttop.go +++ b/_example/ttop.go @@ -1,4 +1,4 @@ -// Copyright 2016 Zack Guo . All rights reserved. +// Copyright 2016 Zack Guo . All rights reserved. // Use of this source code is governed by a MIT license that can // be found in the LICENSE file. diff --git a/_example/wrappar.go b/_example/wrappar.go index 23e00a0..267fa4a 100644 --- a/_example/wrappar.go +++ b/_example/wrappar.go @@ -1,3 +1,7 @@ +// Copyright 2016 Zack Guo . All rights reserved. +// Use of this source code is governed by a MIT license that can +// be found in the LICENSE file. + package main import ui "github.com/gizak/termui" diff --git a/barchart.go b/barchart.go index 9e2a106..1102f34 100644 --- a/barchart.go +++ b/barchart.go @@ -1,4 +1,4 @@ -// Copyright 2016 Zack Guo . All rights reserved. +// Copyright 2016 Zack Guo . All rights reserved. // Use of this source code is governed by a MIT license that can // be found in the LICENSE file. diff --git a/block.go b/block.go index 418738c..43a4c40 100644 --- a/block.go +++ b/block.go @@ -1,4 +1,4 @@ -// Copyright 2016 Zack Guo . All rights reserved. +// Copyright 2016 Zack Guo . All rights reserved. // Use of this source code is governed by a MIT license that can // be found in the LICENSE file. diff --git a/block_common.go b/block_common.go index 0f972cb..aa4a92a 100644 --- a/block_common.go +++ b/block_common.go @@ -1,4 +1,4 @@ -// Copyright 2016 Zack Guo . All rights reserved. +// Copyright 2016 Zack Guo . All rights reserved. // Use of this source code is governed by a MIT license that can // be found in the LICENSE file. diff --git a/block_test.go b/block_test.go index 5b0ce92..0bda680 100644 --- a/block_test.go +++ b/block_test.go @@ -1,4 +1,4 @@ -// Copyright 2016 Zack Guo . All rights reserved. +// Copyright 2016 Zack Guo . All rights reserved. // Use of this source code is governed by a MIT license that can // be found in the LICENSE file. diff --git a/block_windows.go b/block_windows.go index 4dbc017..50480e5 100644 --- a/block_windows.go +++ b/block_windows.go @@ -1,4 +1,4 @@ -// Copyright 2016 Zack Guo . All rights reserved. +// Copyright 2016 Zack Guo . All rights reserved. // Use of this source code is governed by a MIT license that can // be found in the LICENSE file. diff --git a/buffer.go b/buffer.go index 4b91392..cbbab6f 100644 --- a/buffer.go +++ b/buffer.go @@ -1,4 +1,4 @@ -// Copyright 2016 Zack Guo . All rights reserved. +// Copyright 2016 Zack Guo . All rights reserved. // Use of this source code is governed by a MIT license that can // be found in the LICENSE file. diff --git a/buffer_test.go b/buffer_test.go index 5786157..a3cfb0b 100644 --- a/buffer_test.go +++ b/buffer_test.go @@ -1,4 +1,4 @@ -// Copyright 2016 Zack Guo . All rights reserved. +// Copyright 2016 Zack Guo . All rights reserved. // Use of this source code is governed by a MIT license that can // be found in the LICENSE file. diff --git a/canvas.go b/canvas.go index 4173780..911a678 100644 --- a/canvas.go +++ b/canvas.go @@ -1,4 +1,4 @@ -// Copyright 2016 Zack Guo . All rights reserved. +// Copyright 2016 Zack Guo . All rights reserved. // Use of this source code is governed by a MIT license that can // be found in the LICENSE file. diff --git a/canvas_test.go b/canvas_test.go index d059174..5735316 100644 --- a/canvas_test.go +++ b/canvas_test.go @@ -1,4 +1,4 @@ -// Copyright 2016 Zack Guo . All rights reserved. +// Copyright 2016 Zack Guo . All rights reserved. // Use of this source code is governed by a MIT license that can // be found in the LICENSE file. diff --git a/config b/config deleted file mode 100755 index 18fd6a4..0000000 --- a/config +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env perl6 - -use v6; - -my $copyright = '// Copyright 2016 Zack Guo . All rights reserved. -// Use of this source code is governed by a MIT license that can -// be found in the LICENSE file. - -'; - -sub MAIN('update-docstr', Str $srcp) { - if $srcp.IO.f { - $_ = $srcp.IO.slurp; - if m/^ \/\/\s Copyright .+? \n\n/ { - unless ~$/ eq $copyright { - s/^ \/\/\s Copyright .+? \n\n /$copyright/; - spurt $srcp, $_; - say "[updated] doc string for:"~$srcp; - } - } else { - say "[added] doc string for "~$srcp~" (no match found)"; - $_ = $copyright ~ $_; - spurt $srcp, $_; - } - } -} diff --git a/config.py b/config.py new file mode 100644 index 0000000..9152bf5 --- /dev/null +++ b/config.py @@ -0,0 +1,79 @@ +#!/usr/bin/env python3 + +# use v6; +# +# my $copyright = '// Copyright 2016 Zack Guo . All rights reserved. +# // Use of this source code is governed by a MIT license that can +# // be found in the LICENSE file. +# +# '; +# +# sub MAIN('update-docstr', Str $srcp) { +# if $srcp.IO.f { +# $_ = $srcp.IO.slurp; +# if m/^ \/\/\s Copyright .+? \n\n/ { +# unless ~$/ eq $copyright { +# s/^ \/\/\s Copyright .+? \n\n /$copyright/; +# spurt $srcp, $_; +# say "[updated] doc string for:"~$srcp; +# } +# } else { +# say "[added] doc string for "~$srcp~" (no match found)"; +# $_ = $copyright ~ $_; +# spurt $srcp, $_; +# } +# } +# } + +import re +import os +import io + +copyright = """// Copyright 2016 Zack Guo . All rights reserved. +// Use of this source code is governed by a MIT license that can +// be found in the LICENSE file. + +""" + +exclude_dirs = [".git", "_docs"] +exclude_files = [] +include_dirs = [".", "debug", "extra", "test", "_example"] + + +def is_target(fpath): + if os.path.splitext(fpath)[-1] == ".go": + return True + return False + + +def update_copyright(fpath): + print("processing " + fpath) + f = io.open(fpath, 'r', encoding='utf-8') + fstr = f.read() + f.close() + + # remove old + m = re.search('^// Copyright .+?\r?\n\r?\n', fstr, re.MULTILINE|re.DOTALL) + if m: + fstr = fstr[m.end():] + + # add new + fstr = copyright + fstr + f = io.open(fpath, 'w',encoding='utf-8') + f.write(fstr) + f.close() + + +def main(): + for d in include_dirs: + files = [ + os.path.join(d, f) for f in os.listdir(d) + if os.path.isfile(os.path.join(d, f)) + ] + for f in files: + if is_target(f): + update_copyright(f) + + +if __name__ == '__main__': + main() diff --git a/debug/debuger.go b/debug/debuger.go index f723b96..f557fa5 100644 --- a/debug/debuger.go +++ b/debug/debuger.go @@ -1,4 +1,4 @@ -// Copyright 2016 Zack Guo . All rights reserved. +// Copyright 2016 Zack Guo . All rights reserved. // Use of this source code is governed by a MIT license that can // be found in the LICENSE file. diff --git a/doc.go b/doc.go index 0d7108d..fdf7dd0 100644 --- a/doc.go +++ b/doc.go @@ -1,4 +1,4 @@ -// Copyright 2016 Zack Guo . All rights reserved. +// Copyright 2016 Zack Guo . All rights reserved. // Use of this source code is governed by a MIT license that can // be found in the LICENSE file. diff --git a/events.go b/events.go index 6627f89..5ba5263 100644 --- a/events.go +++ b/events.go @@ -1,4 +1,4 @@ -// Copyright 2016 Zack Guo . All rights reserved. +// Copyright 2016 Zack Guo . All rights reserved. // Use of this source code is governed by a MIT license that can // be found in the LICENSE file. diff --git a/events_test.go b/events_test.go index 888559a..3617512 100644 --- a/events_test.go +++ b/events_test.go @@ -1,4 +1,4 @@ -// Copyright 2016 Zack Guo . All rights reserved. +// Copyright 2016 Zack Guo . All rights reserved. // Use of this source code is governed by a MIT license that can // be found in the LICENSE file. diff --git a/extra/tabpane.go b/extra/tabpane.go index 7469199..1ad3f55 100644 --- a/extra/tabpane.go +++ b/extra/tabpane.go @@ -1,4 +1,4 @@ -// Copyright 2016 Zack Guo . All rights reserved. +// Copyright 2016 Zack Guo . All rights reserved. // Use of this source code is governed by a MIT license that can // be found in the LICENSE file. diff --git a/gauge.go b/gauge.go index 01af0ea..a143111 100644 --- a/gauge.go +++ b/gauge.go @@ -1,4 +1,4 @@ -// Copyright 2016 Zack Guo . All rights reserved. +// Copyright 2016 Zack Guo . All rights reserved. // Use of this source code is governed by a MIT license that can // be found in the LICENSE file. diff --git a/grid.go b/grid.go index 364442e..679b825 100644 --- a/grid.go +++ b/grid.go @@ -1,4 +1,4 @@ -// Copyright 2016 Zack Guo . All rights reserved. +// Copyright 2016 Zack Guo . All rights reserved. // Use of this source code is governed by a MIT license that can // be found in the LICENSE file. diff --git a/grid_test.go b/grid_test.go index 07358b0..e53a308 100644 --- a/grid_test.go +++ b/grid_test.go @@ -1,4 +1,4 @@ -// Copyright 2016 Zack Guo . All rights reserved. +// Copyright 2016 Zack Guo . All rights reserved. // Use of this source code is governed by a MIT license that can // be found in the LICENSE file. diff --git a/helper.go b/helper.go index 308f6c1..5870bac 100644 --- a/helper.go +++ b/helper.go @@ -1,4 +1,4 @@ -// Copyright 2016 Zack Guo . All rights reserved. +// Copyright 2016 Zack Guo . All rights reserved. // Use of this source code is governed by a MIT license that can // be found in the LICENSE file. diff --git a/helper_test.go b/helper_test.go index bce952c..d6b5f25 100644 --- a/helper_test.go +++ b/helper_test.go @@ -1,4 +1,4 @@ -// Copyright 2016 Zack Guo . All rights reserved. +// Copyright 2016 Zack Guo . All rights reserved. // Use of this source code is governed by a MIT license that can // be found in the LICENSE file. diff --git a/linechart.go b/linechart.go index 81834ef..1886114 100644 --- a/linechart.go +++ b/linechart.go @@ -1,4 +1,4 @@ -// Copyright 2016 Zack Guo . All rights reserved. +// Copyright 2016 Zack Guo . All rights reserved. // Use of this source code is governed by a MIT license that can // be found in the LICENSE file. diff --git a/linechart_others.go b/linechart_others.go index 7e2e66b..fad7a80 100644 --- a/linechart_others.go +++ b/linechart_others.go @@ -1,4 +1,4 @@ -// Copyright 2016 Zack Guo . All rights reserved. +// Copyright 2016 Zack Guo . All rights reserved. // Use of this source code is governed by a MIT license that can // be found in the LICENSE file. diff --git a/linechart_windows.go b/linechart_windows.go index 1478b5c..9c9917b 100644 --- a/linechart_windows.go +++ b/linechart_windows.go @@ -1,4 +1,4 @@ -// Copyright 2016 Zack Guo . All rights reserved. +// Copyright 2016 Zack Guo . All rights reserved. // Use of this source code is governed by a MIT license that can // be found in the LICENSE file. diff --git a/list.go b/list.go index 0029d26..492b62d 100644 --- a/list.go +++ b/list.go @@ -1,4 +1,4 @@ -// Copyright 2016 Zack Guo . All rights reserved. +// Copyright 2016 Zack Guo . All rights reserved. // Use of this source code is governed by a MIT license that can // be found in the LICENSE file. diff --git a/mbarchart.go b/mbarchart.go index 6828e65..fa6d54c 100644 --- a/mbarchart.go +++ b/mbarchart.go @@ -1,4 +1,4 @@ -// Copyright 2016 Zack Guo . All rights reserved. +// Copyright 2016 Zack Guo . All rights reserved. // Use of this source code is governed by a MIT license that can // be found in the LICENSE file. diff --git a/par.go b/par.go index 78bffd0..14d6b4d 100644 --- a/par.go +++ b/par.go @@ -1,4 +1,4 @@ -// Copyright 2016 Zack Guo . All rights reserved. +// Copyright 2016 Zack Guo . All rights reserved. // Use of this source code is governed by a MIT license that can // be found in the LICENSE file. diff --git a/par_test.go b/par_test.go index 6ecb36d..14813ab 100644 --- a/par_test.go +++ b/par_test.go @@ -1,4 +1,4 @@ -// Copyright 2016 Zack Guo . All rights reserved. +// Copyright 2016 Zack Guo . All rights reserved. // Use of this source code is governed by a MIT license that can // be found in the LICENSE file. diff --git a/pos.go b/pos.go index 2046dce..a0359af 100644 --- a/pos.go +++ b/pos.go @@ -1,4 +1,4 @@ -// Copyright 2016 Zack Guo . All rights reserved. +// Copyright 2016 Zack Guo . All rights reserved. // Use of this source code is governed by a MIT license that can // be found in the LICENSE file. diff --git a/pos_test.go b/pos_test.go index a54522a..edd1095 100644 --- a/pos_test.go +++ b/pos_test.go @@ -1,4 +1,4 @@ -// Copyright 2016 Zack Guo . All rights reserved. +// Copyright 2016 Zack Guo . All rights reserved. // Use of this source code is governed by a MIT license that can // be found in the LICENSE file. diff --git a/render.go b/render.go index dde0451..be3bf46 100644 --- a/render.go +++ b/render.go @@ -1,4 +1,4 @@ -// Copyright 2016 Zack Guo . All rights reserved. +// Copyright 2016 Zack Guo . All rights reserved. // Use of this source code is governed by a MIT license that can // be found in the LICENSE file. diff --git a/sparkline.go b/sparkline.go index 312ad95..e127b52 100644 --- a/sparkline.go +++ b/sparkline.go @@ -1,4 +1,4 @@ -// Copyright 2016 Zack Guo . All rights reserved. +// Copyright 2016 Zack Guo . All rights reserved. // Use of this source code is governed by a MIT license that can // be found in the LICENSE file. diff --git a/test/runtest.go b/test/runtest.go index 99794c4..9130473 100644 --- a/test/runtest.go +++ b/test/runtest.go @@ -1,4 +1,4 @@ -// Copyright 2016 Zack Guo . All rights reserved. +// Copyright 2016 Zack Guo . All rights reserved. // Use of this source code is governed by a MIT license that can // be found in the LICENSE file. diff --git a/textbuilder.go b/textbuilder.go index 06a019b..818a400 100644 --- a/textbuilder.go +++ b/textbuilder.go @@ -1,4 +1,4 @@ -// Copyright 2016 Zack Guo . All rights reserved. +// Copyright 2016 Zack Guo . All rights reserved. // Use of this source code is governed by a MIT license that can // be found in the LICENSE file. diff --git a/textbuilder_test.go b/textbuilder_test.go index 71574e1..b338401 100644 --- a/textbuilder_test.go +++ b/textbuilder_test.go @@ -1,4 +1,4 @@ -// Copyright 2016 Zack Guo . All rights reserved. +// Copyright 2016 Zack Guo . All rights reserved. // Use of this source code is governed by a MIT license that can // be found in the LICENSE file. diff --git a/theme.go b/theme.go index c3ccda5..9632ae7 100644 --- a/theme.go +++ b/theme.go @@ -1,4 +1,4 @@ -// Copyright 2016 Zack Guo . All rights reserved. +// Copyright 2016 Zack Guo . All rights reserved. // Use of this source code is governed by a MIT license that can // be found in the LICENSE file. diff --git a/theme_test.go b/theme_test.go index a6a99b3..f1756ec 100644 --- a/theme_test.go +++ b/theme_test.go @@ -1,4 +1,4 @@ -// Copyright 2016 Zack Guo . All rights reserved. +// Copyright 2016 Zack Guo . All rights reserved. // Use of this source code is governed by a MIT license that can // be found in the LICENSE file. diff --git a/widget.go b/widget.go index 35cf143..f14aa86 100644 --- a/widget.go +++ b/widget.go @@ -1,4 +1,4 @@ -// Copyright 2016 Zack Guo . All rights reserved. +// Copyright 2016 Zack Guo . All rights reserved. // Use of this source code is governed by a MIT license that can // be found in the LICENSE file.