diff --git a/hive-forge/src/verbs/attach.rs b/hive-forge/src/verbs/attach.rs index 91e621ba..a7d60eee 100644 --- a/hive-forge/src/verbs/attach.rs +++ b/hive-forge/src/verbs/attach.rs @@ -26,6 +26,12 @@ pub struct CommentArgs { file: PathBuf, } +/// # Errors +/// +/// Returns an error if the input file doesn't exist or can't be +/// read. Propagates any transport error from the Forgejo REST call +/// (network unreachable, 4xx/5xx response, token missing/invalid) +/// and any I/O error from writing the browser download URL to stdout. pub fn run_issue(client: &Client, args: IssueArgs) -> Result<()> { if !args.file.is_file() { bail!( @@ -42,6 +48,12 @@ pub fn run_issue(client: &Client, args: IssueArgs) -> Result<()> { Ok(()) } +/// # Errors +/// +/// Returns an error if the input file doesn't exist or can't be +/// read. Propagates any transport error from the Forgejo REST call +/// (network unreachable, 4xx/5xx response, token missing/invalid) +/// and any I/O error from writing the browser download URL to stdout. pub fn run_comment(client: &Client, args: CommentArgs) -> Result<()> { if !args.file.is_file() { bail!( diff --git a/hive-forge/src/verbs/comment.rs b/hive-forge/src/verbs/comment.rs index e2aece1a..2a99a380 100644 --- a/hive-forge/src/verbs/comment.rs +++ b/hive-forge/src/verbs/comment.rs @@ -21,6 +21,12 @@ pub struct Args { body_file: Option, } +/// # Errors +/// +/// Propagates any I/O error from the body input (`--body-file`, +/// stdin), any transport error from the Forgejo REST call (network +/// unreachable, 4xx/5xx response, token missing/invalid), and any +/// I/O error from writing the response to stdout. pub fn run(client: &Client, args: Args) -> Result<()> { let body = body::resolve_required(args.body.as_deref(), args.body_file.as_deref(), "comment")?; let repo = client.repo(); diff --git a/hive-forge/src/verbs/comment_edit.rs b/hive-forge/src/verbs/comment_edit.rs index c271a399..a2c9aaaf 100644 --- a/hive-forge/src/verbs/comment_edit.rs +++ b/hive-forge/src/verbs/comment_edit.rs @@ -21,6 +21,12 @@ pub struct Args { body_file: Option, } +/// # Errors +/// +/// Propagates any I/O error from the body input (`--body-file`, +/// stdin), any transport error from the Forgejo REST call (network +/// unreachable, 4xx/5xx response, token missing/invalid), and any +/// I/O error from writing the response to stdout. pub fn run(client: &Client, args: Args) -> Result<()> { let body = body::resolve_required( args.body.as_deref(), diff --git a/hive-forge/src/verbs/issue_create.rs b/hive-forge/src/verbs/issue_create.rs index b80fc027..e785bd0d 100644 --- a/hive-forge/src/verbs/issue_create.rs +++ b/hive-forge/src/verbs/issue_create.rs @@ -24,6 +24,12 @@ pub struct Args { assignee: Option, } +/// # Errors +/// +/// Propagates any I/O error from the body input (`--body-file`, +/// stdin), any transport error from the Forgejo REST call (network +/// unreachable, 4xx/5xx response, token missing/invalid), and any +/// I/O error from writing the issue URL to stdout. pub fn run(client: &Client, args: Args) -> Result<()> { let body = body::resolve(args.body.as_deref(), args.body_file.as_deref())?.unwrap_or_default(); let repo = client.repo(); diff --git a/hive-forge/src/verbs/issue_edit.rs b/hive-forge/src/verbs/issue_edit.rs index ac761624..9a891199 100644 --- a/hive-forge/src/verbs/issue_edit.rs +++ b/hive-forge/src/verbs/issue_edit.rs @@ -46,6 +46,12 @@ pub struct Args { milestone: Option, } +/// # Errors +/// +/// Propagates any I/O error from the body input (`--body-file`, +/// stdin), any transport error from the Forgejo REST call (network +/// unreachable, 4xx/5xx response, token missing/invalid), and any +/// I/O error from writing the response to stdout. pub fn run(client: &Client, args: Args) -> Result<()> { // Body is partial: only update the body field if a source was // actually given. Piped stdin without --body/--body-file leaves diff --git a/hive-forge/src/verbs/pr_create.rs b/hive-forge/src/verbs/pr_create.rs index 3449ac9e..92d1376f 100644 --- a/hive-forge/src/verbs/pr_create.rs +++ b/hive-forge/src/verbs/pr_create.rs @@ -51,6 +51,13 @@ pub struct Args { remote: String, } +/// # Errors +/// +/// Propagates any I/O error from the body input (`--body-file`, +/// stdin) or the `--push` shellout to git, any transport error from +/// the Forgejo REST call (network unreachable, 4xx/5xx response, +/// token missing/invalid), and any I/O error from writing the PR +/// URL to stdout. pub fn run(client: &Client, args: Args) -> Result<()> { let body = body::resolve(args.body.as_deref(), args.body_file.as_deref())?.unwrap_or_default(); if args.push {