tiir

module
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 11, 2023 License: MIT

README

tiir golangci-lint status

A flexible successor to tir:

tir – short for "Today I Read" – is a barebones CLI for logging memorable articles.

Setup

I recommend hosting a tir server on the internet, e.g. with Fly.io, and configuring your local tir CLI to store texts through that server.

CLI

Install the CLI with go install:

$ go install ./cmd/tir

By default, tir is configured to use the rich CLI interface (see pkg/edit/tea.go) and store your data in $HOME/.tir.json (see pkg/store/file.go).

To override those defaults, see Configuration.

For CLI documentation, run tir help.

HTTP server

The tir server is an HTTP interface for a store. You can point a store.HTTP at a running server instance to use its store over HTTP.

To run a server locally, run:

$ go run ./cmd/server

Optionally, see Fly.io's documentation for deploying the server with flyctl launch. That process should prompt you to create a volume, which will store (and automatically back up) your tir database.

If you expose your server to the internet, you should secure endpoints modifying your data with an API key. Generate a secret, then set it in your Fly app's environment:

$ flyctl secrets set TIR_API_SECRET=YOUR_SECRET_HERE

Configuration

tir looks for a configuration file at /etc/tir/.tir.config and $HOME/.tir.config.

Local file store

This .tir.config file configures tir to use a file store rooted at /Users/me/tir.json, to use vim to author and edit stored texts:

{
    "store": {
        "type": "file",
        "path": "/Users/me/.tir.json"
    },
    "editor": "vim"
}
Remote server

This .tir.config file configures tir to talk to a server at https://tir.fly.dev/ that accepts the API secret YOUR_API_SECRET, and to use the rich CLI editor:

{
    "store": {
        "type": "http",
        "base_url": "https://tir.fly.dev/",
        "api_secret": "YOUR_API_SECRET"
    },
    "editor": "tea"
}
Local server

Alternatively, if you're running the server locally on port 8080:

{
    "store": {
        "type": "http",
        "base_url": "localhost:8080",
        "api_secret": "YOUR_API_SECRET"
    },
    "editor": "tea"
}

Directories

Path Synopsis
cmd
tir
pkg
config
Package config loads a tir configuration, either from a JSON file (e.g.
Package config loads a tir configuration, either from a JSON file (e.g.
edit
Package edit provides stock implementations of github.com/lukasschwab/tiir/pkg/text.Editor.
Package edit provides stock implementations of github.com/lukasschwab/tiir/pkg/text.Editor.
render
Package render converts texts to varioius text formats: plaintext, HTML, and syndication feed representations of a collection of texts.
Package render converts texts to varioius text formats: plaintext, HTML, and syndication feed representations of a collection of texts.
store
Package store stores a [text.Text] collection somewhere.
Package store stores a [text.Text] collection somewhere.
text
Package text is the core data model: it's a text you read (past tense).
Package text is the core data model: it's a text you read (past tense).
tir
Package tir provides the interface-facing CRUD service.
Package tir provides the interface-facing CRUD service.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL