Skip to content

Commit

Permalink
Merge for 2.1.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
herrhotzenplotz committed Dec 8, 2023
2 parents 4aa4097 + 9978c40 commit 7bea9c4
Show file tree
Hide file tree
Showing 144 changed files with 4,638 additions and 1,341 deletions.
11 changes: 2 additions & 9 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
root = true
root = true

[*.{c,h}]
[{*.{c,h,sh},Makefile,*.mk}]
end_of_line = lf
insert_final_newline = true
indent_style = tab
tab_width = 4
trim_trailing_whitespace = true

[{Makefile,*.mk}]
end_of_line = lf
tab_width = 4
indent_style = tab
trim_trailing_whitespace = true
insert_final_newline = true
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,4 @@
/m4/ltsugar.m4
/m4/ltversion.m4
/m4/lt~obsolete.m4
/libgcli.pc
27 changes: 13 additions & 14 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ stages:
- testing
- dist

workflow:
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'

alpine-amd64:
stage: testing
tags:
Expand All @@ -15,8 +11,8 @@ alpine-amd64:
- apk add libcurl gcc autoconf automake libtool make pkgconf musl-dev curl-dev flex bison xz gzip bzip2 libbsd-dev kyua atf-dev
- ./autogen.sh
- ./configure CFLAGS='-std=c99 -pedantic -Wall -Wextra -Werror' CPPFLAGS='-D_XOPEN_SOURCE=600' --disable-silent-rules || (cat config.log && exit 42)
- make
- make distcheck
- make -j
- make -j distcheck

freebsd-arm64:
stage: testing
Expand All @@ -26,22 +22,25 @@ freebsd-arm64:
script:
- ./autogen.sh
- ./configure LEX=flex YACC=byacc CFLAGS='-std=c99 -pedantic -Wall -Wextra -Wno-misleading-indentation -Werror' CPPFLAGS='-D_XOPEN_SOURCE=600' --disable-silent-rules || (cat config.log && exit 42)
- make
- make distcheck
- make -j 4
- make -j 4 distcheck

dist:
stage: dist
tags:
- freebsd
- arm64
- linux
image: alpine:3.18
script:
- apk add libcurl gcc autoconf automake libtool make pkgconf musl-dev curl-dev flex bison xz gzip bzip2 libbsd-dev kyua atf-dev cmark
- ./autogen.sh
- ./configure
- make dist
- ./configure CFLAGS='-std=c99 -pedantic -Wall -Wextra -Werror' CPPFLAGS='-D_XOPEN_SOURCE=600' --disable-silent-rules || (cat config.log && exit 42)
- make -j dist
- cd docs/website && ./deploy.sh
artifacts:
name: "Dist Tarballs"
paths:
- gcli-*.tar.*
- docs/website/website_dist.tar.xz

debian-amd64:
stage: testing
Expand All @@ -53,5 +52,5 @@ debian-amd64:
- apt-get install -y --no-install-recommends build-essential libcurl4-openssl-dev pkgconf autotools-dev bison flex make autoconf automake libtool libbsd-dev libatf-dev kyua
- ./autogen.sh
- ./configure CFLAGS='-std=c99 -pedantic -Wall -Wextra -Werror -Wno-misleading-indentation' CPPFLAGS='-D_XOPEN_SOURCE=600' --disable-silent-rules || (cat config.log && exit 42)
- make
- make distcheck
- make -j
- make -j distcheck
9 changes: 9 additions & 0 deletions .hotzrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@ cd build
set-option global ctagscmd "uctags -R --fields=+S"
set-option global ctagspaths "../include ../src ../thirdparty"

# Define the make cmd to be parallel but only use half of the available cpu cores
evaluate-commands %sh{
N=$(nproc)
T=$(($N - 1))
S=$(($T / 2))

echo "set-option global makecmd \"cpuset -l${S}-${T} make -j${T}\""
}

hook global BufSetOption filetype=c %{
add-highlighter buffer/ show-whitespaces -spc " "
smarttab
Expand Down
43 changes: 43 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,49 @@
This changelog does not follow semantic versioning.


## 2.1.0 (2023-Dec-08)

### Added

- Added a little spinner to indicate network activity
- Added Windows 10 MSYS2 to list of confirmed-to-work platforms
- Added a new action `set-visibility` to the repos subcommand that
allows updating the visibility level of a repository.
- Added a new action `request-review` to the pulls subcommand that
allows requesting a review of a pull request from a given user.
- One can now define custom aliases in the alias section of the
config file. Aliases are very primitive as of now. This means they
are just different names for subcommands. Aliases may reference
other aliases.
- Added a new `-M` flag to both the pulls and the issues subcommand
to allow filtering by milestones.
- Added a new `patch` action to the pulls subcommand. This allows
you to print the entire patch series for a given pull request.
Also added the missing implementations for this feature for Github
and Gitea.
- Added a new `title` action to both the issues and the pulls
subcommand that allows updating their titles.

### Fixed

- Fixed incorrect internal help message of the `repos` subcommand.
- Worked around ICE with xlC 16 on ppc64le Debian Linux, gcli now
compiles using xlC and works too.
- Fixed various memory leaks.
- Spelling fixes in manual pages (submitted by Jakub Wilk
https://github.com/herrhotzenplotz/gcli/pull/121)
- Wired up alread existing implementation for forking on Gitea to
gcli command.
- The `status` subcommand now works properly on Gitea.

### Changed

- Subcommands can now be abbreviated by providing an unambiguous
prefix that matches the subcommand.

### Removed


## 2.0.0 (2023-Sep-21)

### Added
Expand Down
37 changes: 30 additions & 7 deletions HACKING.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ working on and debugging gcli.
*Note*: The `--disable-shared` is required because if you build a
shared version of libgcli, libtool will replace the gcli binary with a
shell script that alters the dld search path to read the correct
`libgcli.so`. Because of `build/gcli` now not being a an ELF
`libgcli.so`. Because of `build/gcli` now not being an ELF
executable but a shell script debuggers can't load gcli properly.

#### Sanitized Builds
Expand Down Expand Up @@ -200,15 +200,35 @@ features available in the code generator.

The code generator is fully documented in [pgen.org](docs/pgen.org).

## Generating JSON

We not only need to parse JSON often, we also need to generate it
on the fly when submitting data to forge APIs.

For this the `gcli_jsongen_` family of functions exist. Since these
have been introduced quite late in the project their use is not
particularly wide-spread. However this may change in the future.

To use these, take a look at the header
[include/gcli/json_gen.h](include/gcli/json_gen.h) and also the use
in [src/gitlab/merge_requests.c](src/gitlab/merge_requests.c).

# User Frontend Features

[src/gcli.c](src/gcli.c) is the entry point for the user-facing
tool. In this file you can find the dispatch table for all
subcommands.
The gcli command line tool links against libgcli. Through a context
structure it passes information like the forge type and user
credentials into the library.

All code for the command line frontend tool is found in the
[src/cmd/](src/cmd/) directory.

[src/cmd/gcli.c](src/cmd/gcli.c) is the entry point for the command
line tool. In this file you can find the dispatch table for all
subcommands of gcli.

## Subcommands

Subcommand implementations are found in seperate C files in the
Subcommand implementations are found in separate C files in the
`src/cmd` subdirectory.

When parsing command line options please use `getopt_long`. Do not
Expand All @@ -220,7 +240,10 @@ to `getopt_long` so it needs to reset some internal state.
Output is usually formatted as a dictionary or a table. For these
cases gcli provides a few convenience functions and data structures.

The relevant header is [gcli/table.h](include/gcli/table.h).
The relevant header is [gcli/cmd/table.h](include/gcli/cmd/table.h).

Do not use these functions in the library code. It's only supposed
to be used from the command line tool.

### Tables

Expand All @@ -234,7 +257,7 @@ gcli_tblcoldef cols[] = {
```

For a complete definition look at the header or uses of that interface
in e.g. [src/issues.c](src/issues.c).
in e.g. [src/cmd/issues.c](src/cmd/issues.c).

You can then start adding rows to your table:

Expand Down
37 changes: 26 additions & 11 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ dist_man_MANS = \
docs/gcli-repos.1 \
docs/gcli-snippets.1 \
docs/gcli-status.1 \
docs/gcli.1
docs/gcli.1 \
docs/gcli.5

gcli_SOURCES = \
include/gcli/cmd/ci.h src/cmd/ci.c \
Expand Down Expand Up @@ -114,19 +115,18 @@ TEMPLATES = \
templates/gitlab/pipelines.t \
templates/gitlab/releases.t \
templates/gitlab/repos.t \
templates/gitlab/review.t \
templates/gitlab/sshkeys.t \
templates/gitlab/status.t \
templates/gitlab/snippets.t \
templates/gitea/milestones.t
templates/gitea/milestones.t \
templates/gitea/status.t

headerdir = $(prefix)
nobase_header_HEADERS = include/gcli/gcli.h include/gcli/comments.h \
include/gcli/curl.h include/gcli/forks.h \
include/gcli/issues.h include/gcli/labels.h \
include/gcli/milestones.h include/gcli/pulls.h \
include/gcli/releases.h include/gcli/repos.h \
include/gcli/review.h include/gcli/gitlab/snippets.h \
include/gcli/repos.h include/gcli/gitlab/snippets.h \
include/gcli/status.h include/gcli/sshkeys.h

pkgconfdir = $(libdir)/pkgconfig
Expand All @@ -141,13 +141,13 @@ libgcli_la_SOURCES = \
src/forges.c include/gcli/forges.h \
src/forks.c include/gcli/forks.h \
src/issues.c include/gcli/issues.h \
src/json_gen.c include/gcli/json_gen.h \
src/json_util.c include/gcli/json_util.h \
src/labels.c include/gcli/labels.h \
src/milestones.c include/gcli/milestones.h \
src/pulls.c include/gcli/pulls.h \
src/releases.c include/gcli/releases.h \
src/repos.c include/gcli/repos.h \
src/review.c include/gcli/review.h \
src/gitlab/snippets.c include/gcli/gitlab/snippets.h \
src/status.c include/gcli/status.h \
src/sshkeys.c include/gcli/sshkeys.h \
Expand All @@ -162,7 +162,6 @@ libgcli_la_SOURCES = \
src/gitlab/pipelines.c include/gcli/gitlab/pipelines.h \
src/gitlab/releases.c include/gcli/gitlab/releases.h \
src/gitlab/repos.c include/gcli/gitlab/repos.h \
src/gitlab/review.c include/gcli/gitlab/review.h \
src/gitlab/status.c include/gcli/gitlab/status.h \
src/gitlab/sshkeys.c include/gcli/gitlab/sshkeys.h \
src/github/releases.c include/gcli/github/releases.h \
Expand All @@ -176,7 +175,6 @@ libgcli_la_SOURCES = \
src/github/labels.c include/gcli/github/labels.h \
src/github/milestones.c include/gcli/github/milestones.h \
src/github/issues.c include/gcli/github/issues.h \
src/github/review.c include/gcli/github/review.h \
src/github/checks.c include/gcli/github/checks.h \
src/github/gists.c include/gcli/github/gists.h \
src/github/sshkeys.c include/gcli/github/sshkeys.h \
Expand All @@ -189,6 +187,7 @@ libgcli_la_SOURCES = \
src/gitea/releases.c include/gcli/gitea/releases.h \
src/gitea/repos.c include/gcli/gitea/repos.h \
src/gitea/sshkeys.c include/gcli/gitea/sshkeys.h \
src/gitea/status.c include/gcli/gitea/status.h \
src/gitea/milestones.c include/gcli/gitea/milestones.h \
$(TEMPLATES)

Expand All @@ -208,7 +207,8 @@ EXTRA_DIST = \
HACKING.md \
autogen.sh \
m4/.gitkeep \
docs/pgen.org
docs/pgen.org \
Changelog.md

###########################################
# Tests
Expand All @@ -217,8 +217,10 @@ check_PROGRAMS = \
tests/json-escape$(EXEEXT) \
tests/github-parse-tests$(EXEEXT) \
tests/gitlab-parse-tests$(EXEEXT) \
tests/gitea-parse-tests$(EXEEXT) \
tests/url-encode$(EXEEXT) \
tests/pretty_print_test$(EXEEXT)
tests/pretty_print_test$(EXEEXT) \
tests/test-jsongen$(EXEEXT)

$(check_PROGRAMS): tests/gcli_tests.h

Expand Down Expand Up @@ -246,6 +248,12 @@ tests_gitlab_parse_tests_LDADD = \
libgcli.la libpdjson.la libsn.la \
$(LIBATFC_LDFLAGS)

tests_gitea_parse_tests_SOURCES = \
tests/gitea-parse-tests.c
tests_gitea_parse_tests_LDADD = \
libgcli.la libpdjson.la libsn.la \
$(LIBATFC_LDFLAGS)

tests_url_encode_SOURCES = \
tests/url-encode.c
tests_url_encode_LDADD = \
Expand All @@ -258,6 +266,12 @@ tests_pretty_print_test_LDADD = \
libsn.la \
$(LIBATFC_LDFLAGS)

tests_test_jsongen_SOURCES = \
tests/test-jsongen.c
tests_test_jsongen_LDADD = \
libgcli.la \
$(LIBATFC_LDFLAGS)

EXTRA_DIST += tests/samples/github_simple_comment.json \
tests/samples/github_simple_fork.json \
tests/samples/github_simple_issue.json \
Expand All @@ -276,6 +290,7 @@ EXTRA_DIST += tests/samples/github_simple_comment.json \
tests/samples/gitlab_simple_release.json \
tests/samples/gitlab_simple_repo.json \
tests/samples/gitlab_simple_snippet.json \
tests/samples/github_simple_check.json
tests/samples/github_simple_check.json \
tests/samples/gitea_simple_notification.json

endif
Loading

0 comments on commit 7bea9c4

Please sign in to comment.