* New top-level groups, each with full CRUD where the API supports it: - release: list/view/create/edit/delete/upload/download - label: list/create/edit/delete - run: workflow runs (list/view/rerun/cancel) - secret + variable: Actions secrets/vars (list/set/delete) - search: cross-cutting (repos/issues/prs/users) - browse: open repo/path on the web - status: notifications inbox + mark-all-read - org: list/view/teams - ssh-key, gpg-key: list/add/delete on your account - alias: user-defined shortcuts (e.g. `fj alias set co "pr checkout"`) - config: local prefs (editor, pager, browser, etc.) - extension: discover and run `fj-<name>` plugin binaries on PATH - gist: thin wrapper over `gist-*` repos * main.rs now expands aliases before clap and dispatches to plugins for unknown subcommands (matching gh). * New API modules: release, label, notification, search, org, workflow, with the corresponding strongly-typed wrappers. * Release asset upload uses reqwest multipart (feature flag added). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
47 lines
999 B
Rust
47 lines
999 B
Rust
pub mod issue;
|
|
pub mod label;
|
|
pub mod notification;
|
|
pub mod org;
|
|
pub mod pull;
|
|
pub mod release;
|
|
pub mod repo;
|
|
pub mod search;
|
|
pub mod user;
|
|
pub mod workflow;
|
|
|
|
use anyhow::{anyhow, Result};
|
|
|
|
/// Split an `owner/name` slug. Returns a helpful error if the form is wrong.
|
|
pub fn split_repo(repo: &str) -> Result<(&str, &str)> {
|
|
repo.split_once('/')
|
|
.filter(|(o, n)| !o.is_empty() && !n.is_empty())
|
|
.ok_or_else(|| anyhow!("expected '<owner>/<name>', got '{repo}'"))
|
|
}
|
|
|
|
#[cfg(test)]
|
|
mod tests {
|
|
use super::*;
|
|
|
|
#[test]
|
|
fn parses_normal_slug() {
|
|
let (o, n) = split_repo("rasterstate/fj").unwrap();
|
|
assert_eq!(o, "rasterstate");
|
|
assert_eq!(n, "fj");
|
|
}
|
|
|
|
#[test]
|
|
fn rejects_missing_slash() {
|
|
assert!(split_repo("fj").is_err());
|
|
}
|
|
|
|
#[test]
|
|
fn rejects_empty_owner() {
|
|
assert!(split_repo("/fj").is_err());
|
|
}
|
|
|
|
#[test]
|
|
fn rejects_empty_name() {
|
|
assert!(split_repo("rasterstate/").is_err());
|
|
}
|
|
}
|