summaryrefslogtreecommitdiffstats
path: root/src/wiki.rs
diff options
context:
space:
mode:
authorCyborus <cyborus@cyborus.xyz>2024-08-04 17:28:41 +0200
committerCyborus <cyborus@cyborus.xyz>2024-08-08 01:35:50 +0200
commiteadadf8dd81522b3bdb6ab2c5b7cd3f71cce45cf (patch)
treec271a815d32e7c2cda23aef6aec16004dda39bda /src/wiki.rs
parentMerge pull request 'update `forgejo-api` to v0.4.1' (#104) from api-0.4.1 int... (diff)
downloadforgejo-cli-eadadf8dd81522b3bdb6ab2c5b7cd3f71cce45cf.tar.xz
forgejo-cli-eadadf8dd81522b3bdb6ab2c5b7cd3f71cce45cf.zip
chore: wiki file
Diffstat (limited to 'src/wiki.rs')
-rw-r--r--src/wiki.rs41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/wiki.rs b/src/wiki.rs
new file mode 100644
index 0000000..91792ad
--- /dev/null
+++ b/src/wiki.rs
@@ -0,0 +1,41 @@
+use clap::{Args, Subcommand};
+
+use crate::repo::{RepoArg, RepoInfo};
+
+#[derive(Args, Clone, Debug)]
+pub struct WikiCommand {
+ /// The local git remote that points to the repo to operate on.
+ #[clap(long, short = 'R')]
+ remote: Option<String>,
+ #[clap(subcommand)]
+ command: WikiSubcommand,
+}
+
+#[derive(Subcommand, Clone, Debug)]
+pub enum WikiSubcommand {}
+
+impl WikiCommand {
+ pub async fn run(self, keys: &mut crate::KeyInfo, host_name: Option<&str>) -> eyre::Result<()> {
+ use WikiSubcommand::*;
+
+ let repo = RepoInfo::get_current(host_name, self.repo(), self.remote.as_deref())?;
+ let api = keys.get_api(repo.host_url()).await?;
+ let repo = repo.name().ok_or_else(|| self.no_repo_error())?;
+
+ match self.command {}
+ }
+
+ fn repo(&self) -> Option<&RepoArg> {
+ use WikiSubcommand::*;
+ match &self.command {
+ _ => todo!(),
+ }
+ }
+
+ fn no_repo_error(&self) -> eyre::Error {
+ use WikiSubcommand::*;
+ match &self.command {
+ _ => todo!(),
+ }
+ }
+}