File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed
Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -6,13 +6,15 @@ use crate::provider::{
66} ;
77use clap:: { App , AppSettings , Arg , ArgMatches } ;
88
9+ /// Enumerates the subcommand provider options available from subcommands.
910pub enum Gitpo < ' a > {
1011 Github ( GithubArgs < ' a > ) ,
1112 Gitlab ( GitlabArgs < ' a > ) ,
1213 BitBucket ( BitbucketArgs < ' a > ) ,
1314}
1415
1516impl < ' 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.
4046pub fn get_app ( ) -> App < ' static , ' static > {
4147 App :: new ( "Git Publish" )
4248 . global_setting ( AppSettings :: ColorAuto )
Original file line number Diff line number Diff line change @@ -2,10 +2,16 @@ pub mod bitbucket;
22pub mod github;
33pub mod gitlab;
44
5+ /// Provider outlines the requirements for a provider
56pub 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}
You can’t perform that action at this time.
0 commit comments