pages: Fix "go test" error
./pages.go:255:101: non-constant format string in call to (git.sr.ht/~xenrox/hut/termfmt.Style).Sprintf
lists preferences update: Fix behaviour
When not setting the "copy-self" flag, the current implementation fails:
failure with "copy-self": strconv.ParseBool: parsing "": invalid syntax
Instead, check if the flag is set.
Furthermore, the implementation of PreferencesInput differs from e.g.
hg's RepoInput. For RepoInput the settings can get left out to remain
unchanged - they are pointers. In the case of PreferencesInput CopySelf
is not a pointer, so CopySelf has a default value of "false".
To correctly keep the current settings if no changes have been made, the
old settings need to be retrieved first. Like this the default values of
PreferencesInput can be set correctly.
builds: support filtering job list by tags
This improves the filtering capabilities in `hut builds list` by adding
support for tags.
Since a build triggered by a push to ~simartin/sr.ht-integration-testing
will actually have four tags (sr.ht-integration-testing, commits, master
and .build.yml) that are displayed slash separated in the UI and hut, it
does not make much sense to do a full equality check, and I decided to
do a prefix match.
Signed-off-by: Simon Martin <simon@nasilyan.com>
Correct handling of --count in list commands
The --count attribute is not properly handled: we only check if we've
done enough *after* writing the data for a full page of data from the
API, hence possibly write too much.
This patch keeps track of the number of items written, and stops
processing as soon as it's equal to the count requested by the user, if
any.
Signed-off-by: Simon Martin <simon@nasilyan.com>
config: man is another available service
I noticed the following error when playing with `hut graphql` in
sr.ht-container-compose:
$ echo "{ version { major, minor, patch } }" | myhutcc graphql man
failed to load config file: line 24, directive "man": unknown directive
The problem is that setting up man in
https://git.sr.ht/~whynothugo/sr.ht-container-compose/tree/main/item/hut-config
does not work, while it should, like the other services.
With this patch, things work as expected:
$ echo "{ version { major, minor, patch } }" | myhutcc graphql man
{
"version": {
"major": 0,
"minor": 0,
"patch": 0
}
}
Signed-off-by: Simon Martin <simon@nasilyan.com>
webhook: improve webhook creation --query parameter
This follow-up to 5e75e022 addresses the suggestions made in the review
for that commit, namely (1) deactivates completion for the --query
parameter and (2) mentions it in the documentation.
Fixes: 5e75e022 ("webhook: support passing the query as a command line parameter")
Suggested-by: Thorben Günther <admin@xenrox.net>
Signed-off-by: Simon Martin <simon@nasilyan.com>
todo: Remove unnecessary nil checks
update_schemas: Add schemata for hub and man
webhook: support passing the query as a command line parameter
All the "hut XYZ webhook create" commands require the user to provide a
GQL query, either via stdin or an invocation of $EDITOR.
This makes scripting unnecessarily tedious, and this patch adds a
"--query" parameter to those commands, exclusive with "--stdin".
Signed-off-by: Simon Martin <simon@nasilyan.com>
config: expand ~/ in configuration file
hut fails when invoked with something like "hut --config=~/conf ..."
because the ~ is not expanded:
failed to load config file: open ~/conf: no such file or directory
This adds this expansion.
Signed-off-by: Simon Martin <simon@nasilyan.com>