Sign in

Search issue titles and bodies, change requests and comments. Private repositories you cannot read are not included.

vole
Clone

Read only, no credentials:

https://rodent.software/git/vole.git

Write over SSH with a registered key:

git clone ssh://git@0.0.0.0:2222/vole.git

A free and open-source forge that lives in your Git repo.

Make the CLI speak git's dialect

f956874883e9fdbb95f13b5429bb1104dcec2756 · Keenan Nemetz · 17d ago · parent c1e3e3ca

Make the CLI speak git's dialect

The flags were wrong in the way that matters: `-title` is a single-dash long
option, which anything that thinks like getopt reads as `-t -i -t -l -e`. Git's
conventions (gitcli(7)) are `--long`, `-o`, and no bundling, so this replaces the
parser and every call site.

Now:

- `--long value`, `--long=value`, `-o value`, `-ovalue`.
- Short options are never bundled: `-ab` is not `-a -b`. For an option that takes
  a value, `-mm` is the stuck form and means the value "m"; for a boolean, a
  bundle is an error.
- `-o=value` is refused with a message pointing at `-ov` or `--long=v`, because
  silently taking "=value" is the kind of thing that costs an hour later.
- Options come before arguments, and an option after an argument is an error
  naming the argument rather than something to guess about.
- `--` and `--end-of-options` end option parsing; `-h`/`--help` print the
  subcommand's usage and exit 0; usage mistakes exit 129, as git does.
- `-m`/`-F` mirror `git commit`: mutually exclusive, `-F -` reads stdin.
- `-l` is repeatable; comma-separated still works for convenience.
- `issue list --format` takes `%(id)`, `%(shortid)`, `%(state)`, `%(author)`,
  `%(title)`, `%(labels)`, `%(created)` for scripts.
- `vole.author` is consulted before `user.name` for the default author.

Two bugs came out of the change, both caught by tests rather than by reading:

- The new parser stored `--config` as an ordinary value and never copied it to
  the path the commands actually use, so every command silently fell back to
  ./vole.toml. A test that rebuilds an index in a temp directory failed loudly.
- The integration test itself passed `-config`, which the new parser read as
  `-c onfig` — exactly the ambiguity this commit removes, in the wild.

Verified by hand against a live instance: repeatable `-l`, stuck `--title=x`,
`--format`, `issue comment -m text <id>` accepted, `issue comment <id> -m text`
refused with exit 129 and "options must come before arguments", `-h` exiting 0,
and a missing option value exiting 129.

README.md +12−6

@@ -52,10 +52,10 @@ Not yet: change requests, CI, LFS, static sites, signature verification.
52 52 ```sh
53 53 go build -o vole ./cmd/vole
54 54
55 ./vole init -dir . # config + data/system.git
55 ./vole init --dir . # config + data/trusted_keys
56 56 ./vole user create you
57 ./vole user add-key you -key ~/.ssh/id_ed25519.pub
58 ./vole repo create demo -owner you
57 ./vole user add-key you --key ~/.ssh/id_ed25519.pub
58 ./vole repo create demo --owner you
59 59 ./vole acl default demo read # publish: 404 until you do this
60 60 ./vole serve # ssh :2222, http :8080
61 61 ```
@@ -95,13 +95,19 @@ The id must be a ULID (26 characters, Crockford base32 — uppercase, no `I`, `L
95 95 Or use the CLI, which is the same thing with the paperwork done:
96 96
97 97 ```sh
98 vole issue new -title "Nothing renders on the docs page" -body "Steps..." -label bug
99 vole issue comment 01M5JR2JK29KKMAA1T9MDNTPBP -body "Also affects search"
98 vole issue new --title "Nothing renders on the docs page" -m "Steps..." -l bug
99 vole issue comment -m "Also affects search" 01M5JR2JK29KKMAA1T9MDNTPBP
100 100 vole issue close 01M5JR2JK29KKMAA1T9MDNTPBP
101 vole issue list -state open -label bug
101 vole issue list --state open -l bug --format '%(shortid) %(title)'
102
102 103 vole issue show 01M5JR2JK29KKMAA1T9MDNTPBP # a prefix is enough
103 104 ```
104 105
106 Options follow git's conventions: `--long value`, `--long=value`, `-o value`,
107 `-ovalue`, repeatable `-l`, `--` to end option parsing, and `-h` for usage.
108 Options come before arguments — `vole issue comment -m text <id>`, not the other
109 way round — and a usage mistake exits 129, as git does.
110
105 111 The CLI writes the files, commits to the `issues` branch, validates locally and
106 112 pushes. `#<ulid>` in a body links to that issue, and commits whose message
107 113 mentions an id are listed as backlinks on the issue. The list page filters by