Skip to content

Commit b9bcab6

Browse files
committed
Some documentation
1 parent a884c2c commit b9bcab6

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/cli.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@ use crate::provider::{
66
};
77
use clap::{App, AppSettings, Arg, ArgMatches};
88

9+
/// Enumerates the subcommand provider options available from subcommands.
910
pub enum Gitpo<'a> {
1011
Github(GithubArgs<'a>),
1112
Gitlab(GitlabArgs<'a>),
1213
BitBucket(BitbucketArgs<'a>),
1314
}
1415

1516
impl<'a> Gitpo<'a> {
17+
/// from_matches constructs a subcommand config from the selected subcommand.
1618
pub fn from_matches(matches: &'a ArgMatches) -> Gitpo<'a> {
1719
match matches.subcommand_name() {
1820
Some("github") => Gitpo::Github(github::from_matches(
@@ -28,6 +30,9 @@ impl<'a> Gitpo<'a> {
2830
}
2931
}
3032

33+
/// as_provider
34+
///
35+
/// Returns self as a reference to a Provider
3136
pub fn as_provider(&self) -> &dyn Provider {
3237
match self {
3338
Gitpo::Github(x) => x as &Provider,
@@ -37,6 +42,7 @@ impl<'a> Gitpo<'a> {
3742
}
3843
}
3944

45+
/// ## Returns highest-level clap app.
4046
pub fn get_app() -> App<'static, 'static> {
4147
App::new("Git Publish")
4248
.global_setting(AppSettings::ColorAuto)

src/provider/mod.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,16 @@ pub mod bitbucket;
22
pub mod github;
33
pub mod gitlab;
44

5+
/// Provider outlines the requirements for a provider
56
pub trait Provider {
7+
///A JSON payload to send to the provider's endpoint
68
fn payload(&self) -> String;
9+
///The endpoint to send the POST, usually the form of api.___.com
710
fn endpoint(&self) -> String;
8-
fn extract_url(&self, src: &reqwest::header::HeaderMap) -> String;
11+
/// A method to extract the remote url from the response headers.
12+
fn extract_url(&self, _: &reqwest::header::HeaderMap) -> String;
13+
/// The response token formatted as the request body.
914
fn token(&self) -> String;
15+
/// The response header key. Like `Authorization` or `Bearer`
1016
fn auth_header(&self) -> String;
1117
}

0 commit comments

Comments
 (0)