copyright messgae and verbose mode

This commit is contained in:
ston1th 2017-04-06 21:14:48 +02:00
commit a3270f399d
12 changed files with 40 additions and 6 deletions

View file

@ -1,3 +1,5 @@
// Copyright (C) 2017 Marius Schellenberger
package main
import (

12
dump.go
View file

@ -1,3 +1,5 @@
// Copyright (C) 2017 Marius Schellenberger
package main
import (
@ -17,6 +19,12 @@ type DumpArticle struct {
Public bool `json:"public"`
}
func verboseLog(prefix, title string) {
if verbose {
fmt.Fprintln(os.Stderr, prefix, title)
}
}
func dumpWiki() error {
index, err := bleve.OpenUsing(bleveStore, map[string]interface{}{"read_only": true})
if err != nil {
@ -38,7 +46,7 @@ func dumpWiki() error {
if err != nil {
return err
}
fmt.Fprintln(os.Stderr, "dump:", art.Title)
verboseLog("dump:", art.Title)
arts = append(arts, DumpArticle{
Title: art.Title,
LinkTitle: art.LinkTitle,
@ -68,7 +76,7 @@ func restoreWiki() (err error) {
return
}
for _, art := range arts {
fmt.Fprintln(os.Stderr, "restore:", art.Title)
verboseLog("restore:", art.Title)
err = engine.Restore(art)
if err != nil {
return

View file

@ -1,3 +1,5 @@
// Copyright (C) 2017 Marius Schellenberger
package main
import (

View file

@ -1,3 +1,5 @@
// Copyright (C) 2017 Marius Schellenberger
package main
import (

View file

@ -1,3 +1,5 @@
// Copyright (C) 2017 Marius Schellenberger
package main
import (

View file

@ -1,3 +1,5 @@
// Copyright (C) 2017 Marius Schellenberger
//go:generate ./templates.sh
package main
@ -48,6 +50,7 @@ var (
dump bool
restore bool
verbose bool
)
func main() {
@ -59,6 +62,7 @@ func main() {
flag.BoolVar(&secureCookie, "s", false, "enable secure cookie")
flag.BoolVar(&dump, "dump", false, "create a json dump of all articles in the data directory (dump is written to stdout)")
flag.BoolVar(&restore, "restore", false, "restore a json dump to the data directory (dump is read from stdin)")
flag.BoolVar(&verbose, "v", false, "enable verbose dump/restore mode")
flag.Parse()
err := os.Chdir(datadir)

View file

@ -1,3 +1,5 @@
// Copyright (C) 2017 Marius Schellenberger
package main
import (

View file

@ -1,3 +1,5 @@
// Copyright (C) 2017 Marius Schellenberger
package main
import (

2
sri.sh
View file

@ -1,4 +1,6 @@
#!/bin/bash
# Copyright (C) 2017 Marius Schellenberger
HASH="sha256"
DIR="templates"
FILES="*.css *.js *.ico"

View file

@ -1,3 +1,5 @@
// Copyright (C) 2017 Marius Schellenberger
// This file is auto-generated by build/templates.sh
// using the contents of the templates directory
@ -321,7 +323,7 @@ const (
{{if .Admin}}
<div class="row">
<div class="col-lg-5">
<a href="/user/new"><b>New User</b></a>
<a class="btn btn-sm btn-primary" href="/user/new"><b>New User</b></a>
</div>
</div>
{{end}}
@ -347,11 +349,11 @@ const (
<td>no</td>
{{end}}
{{if $admin}}
<td><a href="/user/edit/{{$item.Username}}">Edit</a>&nbsp;
<a href="/user/del/{{$item.Username}}">Delete</a></td>
<td><a class="btn btn-xs btn-primary" href="/user/edit/{{$item.Username}}">Edit</a>&nbsp;
<a class="btn btn-xs btn-danger" href="/user/del/{{$item.Username}}">Delete</a></td>
{{else}}
{{if eq $item.Username $user}}
<td><a href="/user/edit/{{$item.Username}}">Edit</a></td>
<td><a class="btn btn-xs btn-primary" href="/user/edit/{{$item.Username}}">Edit</a></td>
{{else}}
<td></td>
{{end}}

View file

@ -1,4 +1,6 @@
#!/bin/bash
# Copyright (C) 2017 Marius Schellenberger
# this file generates Go source code for the gowiki
# it contains html and css and uses the contents
# of the templates directory
@ -12,6 +14,8 @@ if [ ! -d templates ]; then
fi
cat << EOF > ${templates_go}
// Copyright (C) 2017 Marius Schellenberger
// This file is auto-generated by build/templates.sh
// using the contents of the templates directory

View file

@ -1,3 +1,5 @@
// Copyright (C) 2017 Marius Schellenberger
package main
import (