Update README

This commit is contained in:
Trevor Slocum 2019-04-16 18:01:50 -07:00
parent 5a52f4e88d
commit 41e882801a
4 changed files with 48 additions and 25 deletions

View File

@ -1,34 +1,63 @@
# stick
[![GoDoc](https://godoc.org/git.sr.ht/~tslocum/stick?status.svg)](https://godoc.org/git.sr.ht/~tslocum/stick)
[![builds.sr.ht status](https://builds.sr.ht/~tslocum/stick.svg)](https://builds.sr.ht/~tslocum/stick?)
Simple, shareable notes (NOTE: experimental)
Shareable Git-backed Markdown-formatted notes
## .stick.yml
## Install
Notebooks are standard git repositories containing Markdown formatted notes.
```
GO111MODULE=on go get -u git.sr.ht/~tslocum/stick
```
Configure stick via ~/.config/stick/stick.yml (or elsewhere with --config)
## Configure
Initialize a notebook by creating an empty git repository:
```
stick init /home/stick/notes/johnsnotes
```
Configure stick via ~/.config/stick/stick.yml (or elsewhere by using --config later)
```yaml
# Used when hashing data (set to a random string)
salt: "xXxsh3cr3txXx"
authors:
john: John Doe
jane: Jane Doe
# Serve notes on localhost only
# Set to ":9991" to serve on all interfaces (not recommended, use a reverse proxy instead)
serve: "localhost:9991"
# Authors are defined by email and name (used when committing)
authors:
john@hotmail.com: John Doe
jane@aol.com: Jane Doe
# Notebooks can be shared between authors with varying access levels
# When an access level isn't specified, read/write is assumed
# John's notebook allows read/write access to himself and read-only access to Jane
notebooks:
"John's notes":
repo: home/stick/notes/johnsnotes/
repo: /home/stick/notes/johnsnotes
serve:
john
john@hotmail.com
jane@aol.com: read
"Jane's notes":
repo: /home/stick/notes/janesnotes/
repo: /home/stick/notes/janesnotes
serve:
jane
jane@aol.com
john@hotmail.com: read
"Groceries":
repo: /home/stick/notes/groceries/
repo: /home/stick/notes/groceries
serve:
john
jane
john@hotmail.com
jane@aol.com
```
Then run stick:
```
stick serve
```

View File

@ -1,7 +1,5 @@
package main
const DefaultAuthorEmail = "stick@notes.app"
type Author struct {
Key string
Name string

View File

@ -23,7 +23,7 @@ func main() {
app := cli.NewApp()
app.Name = "stick"
app.Usage = "simple, shareable notes"
app.Usage = "Shareable Git-backed Markdown-formatted notes"
app.Version = ""
app.HideVersion = true
@ -63,15 +63,11 @@ func main() {
cloneURL := c.Args().Get(1)
n, err := InitializeRepository(path, cloneURL)
_, err := InitializeRepository(path, cloneURL)
if err != nil {
panic(errors.Wrap(err, "failed to initialize notebook"))
}
_ = n
printServedNotebooks() // TODO: Print newly served notebooks only
fmt.Println("notebook initialized")
return nil
},

6
web.go
View File

@ -481,7 +481,7 @@ func webEdit(s *StickSocket, c *StickSocketCommand) *map[string]interface{} {
_, err = wt.Commit(commitMessage+" "+fileName, &git.CommitOptions{
Author: &object.Signature{
Name: s.Author.Name,
Email: DefaultAuthorEmail,
Email: s.Author.Email,
When: time.Now(),
},
})
@ -572,7 +572,7 @@ func webCheck(s *StickSocket, c *StickSocketCommand) *map[string]interface{} {
_, err = wt.Commit("update "+file.Name, &git.CommitOptions{
Author: &object.Signature{
Name: s.Author.Name,
Email: DefaultAuthorEmail,
Email: s.Author.Email,
When: time.Now(),
},
})
@ -620,7 +620,7 @@ func webDelete(s *StickSocket, c *StickSocketCommand) *map[string]interface{} {
_, err = wt.Commit("delete "+file.Name, &git.CommitOptions{
Author: &object.Signature{
Name: s.Author.Name,
Email: DefaultAuthorEmail,
Email: s.Author.Email,
When: time.Now(),
},
})