pager/editor: Use shlex to parse command

This will at least allow hut to handle flags.

References: https://todo.sr.ht/~emersion/hut/44
todo ticket list: Add status filtering
todo ticket edit: new command
config: use scfg decoder to read config file
499ef887 — delthas 4 months ago
import: Fix wrong import path

FindDirResources returns a list of resources, with paths pointing
to dirs containing an info.json

ImportResource was incorrectly taking the Dir of that path, but
the path is already the right one, we should not take the Dir.

import was effectively broken before this patch.
import: accept multiple directories
783eee5f — delthas 4 months ago
export: Support specifying services and resources

This adds support for exporting specific resources or services, by
passing their URL to hut export.

This also implicitly adds support for exporting resources of other
users, by explicitly specifying the URL of a resource they own.

The same output tree is kept: $out/$service/$name. This means that
importing two repos of the same name by different users will not
work, but it makes sense: when importing, we cannot create those
two resources with the same name.
client: remove unused Client.Hostname
export: fix writeExportStamp return value
ee9502bc — delthas 4 months ago
Add the import command

Now that export is supported, we are adding a command to import
that data back to another sourcehut instance or account.

The design is to have export lay out a tree of directories by
service and resource, with each resource containing a info.json
file with common fields (service and resource name) and possibly
additional fields depending on the service. Import builds on top
of that existing design by walking the file tree from the given
folder, finding any info.json file, and passing the folder
containing that file to the relevant importer.

For example, export could write:

Then, import started on /out would walk the tree, finding:

It passes "/out/git.sr.ht/kuroneko" to the git.sr.ht importer and
"/out/meta.sr.ht" to the meta.sr.ht importer.

import could also be started on /out/git.sr.ht to import only
resources of that service, or even /out/git.sr.ht/kuroneko to
import that project only.

Specific care was given not to abort import in case of an error
while importing a single resource, because this is typically due
to a resource already existing, so we just log and skip to the
next resource. This has the added benefit of being somewhat
idempotent, as running import twice would skip over existing
resources created over the first run.
A particular exception to this are pastes, which are created
with a new ID every time, and therefore are created again on
a second run.

Of note is that the resulting Export and ImportResource are not
symetrical: Export export all resources of the service, while
ImportResource imports a single resource. This is intended for now,
as a intermediate step before enriching the export command with
a way to select individual resources to export (therefore creating
something similar to an ExportResource).

Additionally, meta.sr.ht now outputs an info.json file (just to
let the import code automatically discover it and import SSH and
PGP keys). We store all PGP keys in the same file to reflect what
srht does on its meta/~username.pgp endpoint, at the cost of manual
string processing.
export/meta: write info.json file
export/paste: ignore empty filenames
export/lists: add visibility
4b6943c8 — delthas 4 months ago
export/hg: add readme and nonPublishing
70338179 — delthas 4 months ago
export/git: add readme and head
Upgrade hg schema

This is still a manual step, and updates to the latest commit rather
than the latest version. Fixes go generate.
Update GraphQL schema
Upgrade dependencies
Fix panic when access-token-cmd returns an empty string
builds secret share: Implement user completion

The new CoMaintainer completion gets introduced here, which gets a list
of those from the ACL entries of a repository. This can be salvaged by
other services than git, e.g. for proposing people to assign tickets to.