···11# Lasa
2233-Lasa is stateless proxy that generates an RSS/Atom feed from a [Standard.site](https://Standard.site) publication.
33+Lasa is stateless proxy that generates a RSS or an Atom feed from a [Standard.site](https://standard.site) publication.
4455## Usage
66
···1717 `lasa publication <identifier> [rkey]`,
1818 `List publications of identifier (can be a DID or an Handle) or display a specific publication referenced by its rkey`,
1919 nil,
2020- nil,
2020+ flags,
2121 []string{
2222 "lasa publication anhgelus.world\t-\tdisplay publications of anhgelus.world",
2323 "lasa publication did:plc:123\t-\tdisplay publications of did:plc:123",
···3030}
31313232func handlePublication(args []string) {
3333- if len(args) == 0 {
3333+ if len(args) == 0 || help {
3434 handlePublicationUsage()
3535 return
3636 }
+2-2
cmd/lasa/rss.go
···1616 `lasa rss <identifier> <rkey>`,
1717 `Generate the RSS for the given publication.`,
1818 nil,
1919- nil,
1919+ flags,
2020 []string{
2121 "lasa publication did:web:example.org fooBar\t-\tgenerate RSS publication of did:web:example.org referenced by fooBar",
2222 },
···2727}
28282929func handleRSS(args []string) {
3030- if len(args) != 2 {
3030+ if len(args) != 2 || help {
3131 handleRSSUsage()
3232 return
3333 }
+61
cmd/lasad/main.go
···11+package main
22+33+import (
44+ "flag"
55+ "os"
66+77+ "tangled.org/anhgelus.world/lasa/cmd/internal"
88+ "tangled.org/anhgelus.world/lasa/cmd/lasad/config"
99+)
1010+1111+var (
1212+ flags *flag.FlagSet
1313+ help = false
1414+ configPath = config.DefaultPath
1515+)
1616+1717+func init() {
1818+ flags = flag.NewFlagSet("default", flag.PanicOnError)
1919+ flags.BoolVar(&help, "h", help, "display the help")
2020+ flags.StringVar(&configPath, "c", configPath, "path to the config")
2121+}
2222+2323+var commands = []internal.Command{
2424+ {Name: "run", Usage: "run the daemon", Callback: handleRun},
2525+}
2626+2727+func main() {
2828+ flags.Parse(os.Args[1:])
2929+ args := flags.Args()
3030+ command := "run"
3131+ if len(args) > 0 {
3232+ command = args[0]
3333+ }
3434+ var next []string
3535+ if len(args) > 1 {
3636+ next = args[1:]
3737+ }
3838+ for _, c := range commands {
3939+ if c.Name == command {
4040+ flags.Parse(next)
4141+ next = flags.Args()
4242+ c.Callback(next)
4343+ return
4444+ }
4545+ }
4646+ handleHelp(args)
4747+ os.Exit(1)
4848+}
4949+5050+func handleHelp([]string) {
5151+ internal.Usage(
5252+ `lasad <command>`,
5353+ `Daemon running Lasa.`,
5454+ nil,
5555+ flags,
5656+ []string{
5757+ "lasad\t-\trun the daemon",
5858+ "lasad -c /foo/bar.toml\t-\trun the daemon with the config at /foo/bar.toml",
5959+ },
6060+ )
6161+}