git_adr/wiki/
mod.rs

1//! Wiki synchronization for git-adr.
2//!
3//! This module provides synchronization between ADRs and wiki platforms:
4//! - GitHub Wiki
5//! - GitLab Wiki
6
7use crate::Error;
8
9mod github;
10mod gitlab;
11mod service;
12
13pub use service::{WikiConfig, WikiPlatform, WikiService};
14
15/// Check if wiki features are available.
16#[must_use]
17pub fn is_available() -> bool {
18    true
19}
20
21/// Detect the wiki platform from the git remote.
22///
23/// # Errors
24///
25/// Returns an error if detection fails.
26pub fn detect_platform(remote_url: &str) -> Result<WikiPlatform, Error> {
27    if remote_url.contains("github.com") {
28        Ok(WikiPlatform::GitHub)
29    } else if remote_url.contains("gitlab.com") || remote_url.contains("gitlab") {
30        Ok(WikiPlatform::GitLab)
31    } else {
32        Err(Error::WikiError {
33            message: format!("Unknown wiki platform for remote: {remote_url}"),
34        })
35    }
36}