Commit Graph

56 Commits

Author SHA1 Message Date
da8f008f1a Use current-dir as final fallback repo name
It all falls into place! I had been dreading doing this bit, but after
updating the usage guide I realized the CLI args should be split, too.
Which finally means that I can just glue on the PWD name as a final
fallback for the repo name.

Try the args, then the config file(s), then PWD. If nothing works, the
user is in a world of hurt. Bail out.
2025-07-21 14:48:30 -05:00
fc0d1b569c Add a project path CLI option 2025-07-21 11:56:20 -05:00
0e814b86a1 Fix some clippy lints 2025-07-21 10:52:20 -05:00
0e3aa16e00 Another autoformat 2025-07-20 17:36:49 -05:00
3453f64312 Wire in the conf file loading, assume PWD project
Load the configuration for the current directory. The project guessing
mechanism isn't here, yet, so this will have to do.

First take the properties set via Args. This will also capture the
values set through environment variables. For anything that's missing,
try to fill it with the info from the configuration files. In the event
that there isn't enough information, new error types have been added to
signal mis-use.
2025-07-20 12:33:38 -05:00
84eaaa1dbd Autoformat 2025-07-03 18:03:33 -05:00
336f1453b9 Address most of the cargo-clippy lints 2025-07-03 17:56:07 -05:00
f068e8233e Release.colorized(), not std::fmt::Display
I don't know for sure if the string-ified version of a Release struct is
being printed to the terminal. As such, I don't know if the user wants,
does not want, or has mixed intentions for the stringification of this
thing.

No Display impl, instead just a `colorized()` method.
2025-07-03 17:47:50 -05:00
d4ef21e243 Change to free-fn intersperse for stdlib compat
Itertools warns that the standard library may be stabilizing the
intersperse method soon and recommends using this function instead.
2025-07-02 22:44:06 -05:00
d94c350cde Galaxy-brained newline intersperse function
Itertools already has an intersperse method for me. Why would I build my
own when I can do this? There's even a `fold()` over the units that come
out of the print routine.
2025-07-02 22:29:07 -05:00
ea046c929f Print releases in reverse order for easier reading
The result list has the newest item first, but I want to print them the
other way around. This way the newest (and presumably most interesting)
release is always the visible item, regardless of how many others have
printed and scrolled off screen.
2025-07-02 21:42:41 -05:00
135acf09b7 Basic impl Display for the Release struct
I'm not certain what info I want to present when listing the Releases.

The idea is that the release version is the most important, and that it
matches the git-tag associated with the release. I'll print that first.

Next, the name of the release followed by the body text. The list of
releases will become quite large for some projects, and the body text
may include a changelog. Both of these will cause the output to become
quite large. I will need to create a size limiter, but I'm ignoring that
for now.

Who created the release and when may be useful when searching for a
release, so I've included that as the final section.
2025-07-02 12:56:17 -05:00
a0ba8e7ea8 Use pre Rust 1.81 compatible file-exists test
The function `std::fs::exists(...)` was stabilized in Rust 1.81, which
means it can't be used in the Debian Bookworm build. This patch swaps to
a compatible implementation leaning on the std::path::Path struct.

I'm both "upstreaming" a Debian-specific patch I had to make for the
package, and fixing the additional usage now in `main.rs`. There doesn't
seem to be any compelling reason to avoid using this function, so I
figure I should merge it into the base release.
2025-06-12 16:05:51 -05:00
06795df3f7 Update main.rs to use new attachment iface 2025-06-07 23:57:19 -05:00
2501213d4f Rename the project to be gt-tool singular 2025-06-06 18:20:15 -05:00
aadaff5db4 Add "No such release" error variant 2025-06-05 20:58:46 -05:00
340b37cf05 Disable the unimplemented "create" arg for uploads
I never got around to implementing the create-and-upload behavior for
the file attachment command. I'll do it later, but for now I'm disabling
the code to quiet down the compiler warnings.
2025-06-01 20:44:56 -05:00
0a4de1cb92 Drop the prerelease flag for create-release
Releases in a "pre-release" state are... weird. I'm not going to deal
with their oddities right now, so instead I'm dropping the command
option and hard-coding a `false` at it's usage site.
2025-06-01 20:42:05 -05:00
bbf1eecc52 Rename the user-agent string, include pkg version
It's no longer a test agent, it's the release one. We're including the
package version (as specified in Cargo.toml).
2025-06-01 15:03:08 -05:00
e0c21fceaf Autoformat the whole thing
I've been putting this off because I don't want to have many small
formatting commits, and I don't have any kind of pre-commit hook to do
it for me. So here it is :v
2025-06-01 13:28:06 -05:00
448aac531a Find matching release ID for release-attachment
I've finally implemented the by-tag release matching thing. The info put
in on the command line actually gets used to attach files to the
release!
2025-06-01 12:24:16 -05:00
8ab1f77b0e Only apply the Auth token header if a token exists 2025-05-31 22:21:41 -05:00
508e2ac802 Fix auth token header, needs "token" prefix
https://docs.gitea.com/development/api-usage#authentication

I had this right earlier, but dropped it after the switch to a pre-
configured client via ClientBuilder a few commits ago.
2025-05-31 20:53:36 -05:00
baf0117a74 Delete the error mapper utility
Now that all API functions are the new versions using my gt_tools::Error
type natively, I don't need to map from the reqwest::Error into the
wrapped variant.
2025-05-29 17:46:00 -05:00
3e563d4bb0 Clean up now-unused imports in main.rs 2025-05-29 17:45:46 -05:00
e848d9ace5 Delete old do_upload_release 2025-05-29 17:42:54 -05:00
6b537c8992 Hook in new create_release_attachment to main 2025-05-29 17:42:31 -05:00
29172bae0b Delete old do_create_release function 2025-05-28 20:29:41 -05:00
4250deb419 Implement new fn create_release() 2025-05-28 20:27:52 -05:00
a212dc3ceb Drop unused imports 2025-05-28 20:27:31 -05:00
766703b8ec Load API token at startup, not API calls 2025-05-28 20:21:13 -05:00
a16594f5a9 Use our own Error enum in fn main 2025-05-28 19:33:52 -05:00
90ae47abb2 Delete old do_list_releases, wire in the new one
With an `.unwrap()` because the error types don't match right now.
2025-05-27 23:05:03 -05:00
5db1134257 Move CreateReleaseOption to new tree 2025-05-27 20:46:04 -05:00
5f666a8179 Move the Release info structs to new tree 2025-05-27 20:43:39 -05:00
b26436d5be Remove already commented-out code & dbg prints 2025-05-27 19:26:11 -05:00
053ee8def9 Use file name, not whole path as upload name 2025-05-27 19:21:05 -05:00
c731cd963c Some but not all of the upload routine 2025-05-27 19:19:09 -05:00
54487622c0 Add CLI option for uploading files + dummy hookup
I think this is the interface I want for uploading release files. There is an extra option to create the release ahead of the upload just in case it doesn't exist. One *should* create it with the create command or through the Gitea GUI so that everything can be properly written into the release info.
2025-05-25 09:08:22 -05:00
8843640385 Thread the primary args through the operation fn's 2025-05-24 19:33:46 -05:00
985c411902 Wire in the release CLI args to the creation fn 2025-05-24 18:47:51 -05:00
973d9aa6c6 Fix: missing slash between owner and repo 2025-05-24 18:29:49 -05:00
0f4f2ee48f TODO: Serde won't make empty-vec 2025-05-24 18:17:41 -05:00
d4ec677b28 Internal-ize API endpoint assembly for create-release 2025-05-24 18:15:01 -05:00
2c9cd5b958 Move list-releases code to its own function 2025-05-24 18:13:39 -05:00
f7ba2e99aa Assemble fragments to get API endpoint 2025-05-24 18:13:10 -05:00
2705900e10 Lint 2025-05-24 17:59:17 -05:00
80637ca76c Move create-release code to it's own function 2025-05-24 17:56:10 -05:00
19cb224598 Hook up the new deserialization structs 2025-05-24 17:07:08 -05:00
f1da1b508a Releases can now be created... sorta
The API token is read from the environment variable `RELEASE_KEY_GITEA`.
"GITEA" is on the end because Gitea itself will refuse to allow users to
configure Act variables starting with the name "GITEA_".

All information about the release is hard-coded right now. I just needed
to see it hit the API and appear on the Gitea page. Hooking up the extra
options is up next.
2025-05-24 15:14:53 -05:00